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.
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.
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
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.
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.
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.