/help, /commands, etc commands [FX]

Information

This script will allow you to create text commands, such as /help, /teamspeak, etc…
You can call it what ever you want the command to be, this script is really small and its simple, This is pretty much the same as before with CitMP server, although people were saying it wasn’t working for some reason? It just made this in like under a minute, there are instructions in the server.lua file on how to add commands.

Questions?

The resource quite simple, but if you have any questions, message me on the forum.

Update

Updated version working with Essentialmode (Also you can add permission / group only commands…)

-- These are the commands

TriggerEvent('es:addAdminCommand', "command-name-here", 0, function(source, args, user)
	TriggerClientEvent('chatMessage', "Messages go here.")
	TriggerClientEvent('chatMessage', "Message 2")
	TriggerClientEvent('chatMessage', "Message 3")
	TriggerClientEvent('chatMessage', "Message 4")
end, function(source, args, user)
	TriggerClientEvent('chatMessage', "ERROR: Something went wrong...") -- This is either the error message or no permission message
end)

-- Don't remove es:addAdminCommand.
-- The 'command-name-here' is clearly your command name !!NOT INCLUDING /!!
-- 0 is the lowest needed permission level.. so make it 0 if you want everyone to use it. (Or you can change it to a group name, ex: "admin")
-- so to create new commands, copy the TriggerEvent part down to the end) part and change it how you like
-- I recommend using the EssentialMode thread for more help, this stuff is really easy.



1 Like

Sorry if this is a stupid question but do we edit the __resource.lua file?

You edit the server.lua

The __resource.lua file contains the links to each used file in the resource.
You should only modify it if you want to remove a file from being loaded, or add more.

when we add the command does the folder need to script were grabbing the command from need to be on the server as well ?

I’m not exactly understanding what your talking about.

If you are talking about the commands, you can put it in any server script / resource folder aslong as you start the script when the server starts, although I don’t recommend using this script anymore, Im going to be making a new one for EssentialMode 4.0

(This still works btw)

when will the new script work with fx server and essentail 4.00

Hey,

Sorry for the delays, been busy.

Anyways, Im gonna put the new one up in about an hour.

Update; added es commands, and permission stuff… enjoy, I don’t recommend using the old version, although do what you like.

so if i wanted to to do a /help or /rules for example what would it look like in the server . cfg? what would i change to make it so you have to type that in chat, and what would i chat to put what message they get back, an example would be muchly appreciated, mickie.

Will this work with vRP also?

Hi @Jordie How can I add a command (/sur) that set the user’s hunger and thirst to 0?

I tried using your script but without results:

TriggerEvent('es:addAdminCommand', "/sur", "admin", function(source, args, user)
	local user_id = vRP.getUserId(player)
	vRP.varyHunger(user_id),-100)
	vRP.varyThirst(user_id),-100)
	TriggerClientEvent('chatMessage', "Fame e sete ripristinati.")
end, function(source, args, user)
	TriggerClientEvent('chatMessage', "ERRORE: Non hai i permessi necessari.") -- This is either the error message or no permission message
end)

I type it in chat but nothing happens. Yes I have last EssentialMode installed 4.6.3. version.

why are you trying to change health of vrp when your using essentialmode? essentialmode doesnt even have hunger

I have vRP working. Is impossible to have vRP and EssentialMode working togheter?

Read the essential mode docs…

Anyways heres the fix:

TriggerEvent('es:addAdminCommand', "sur", "admin", function(srouce, args, user)

Don’t use / in the command name.

Links don’t work anymore, is there an alternative?

I got rid of my site, I don’t use it anymore.

anyways,

Make a folder called “Commands” (Or something random),

then create a file called ‘sv_chat.lua’, then paste the code into it

– These are the commands

TriggerEvent('es:addAdminCommand', "command-name-here", 0, function(source, args, user)
	TriggerClientEvent('chatMessage', "Messages go here.")
	TriggerClientEvent('chatMessage', "Message 2")
	TriggerClientEvent('chatMessage', "Message 3")
	TriggerClientEvent('chatMessage', "Message 4")
end, function(source, args, user)
	TriggerClientEvent('chatMessage', "ERROR: Something went wrong...") -- This is either the error message or no permission message
end)
-- Don't remove es:addAdminCommand.
-- The 'command-name-here' is clearly your command name !!NOT INCLUDING /!!
-- 0 is the lowest needed permission level.. so make it 0 if you want everyone to use it. (Or you can change it to a group name, ex: "admin")
-- so to create new commands, copy the TriggerEvent part down to the end) part and change it how you like
-- I recommend using the EssentialMode thread for more help, this stuff is really easy.

Then create another file called ‘__resource.lua’

then put this into there:

server_script "sv_chat.lua"

Save it, then add the folder name to your auto start resources.

haha ok thank you :slight_smile:

np enjoy. // MESSAGE 2 SHORT

cant download the file. says the server is offline.