Syntasu
21
RegisterCommand("run", function(source, args, rawCommand)
-- Run code when command is ran.
end, true) -- True -> everyone can run the command, else use acl permissions.
Pretty much.
Yeah lmao I know, this isn’t my code. Just this guy was having an error so I simply showed him he was missing the closing bracket.
Honestly I would recommend just using a client and server file and running it in a proximity.
Client
RegisterNetEvent('proxRunInfo')
AddEventHandler('proxRunInfo', function(id, name, message)
local copId = PlayerId()
local plyId = GetPlayerFromServerId(id)
if plyId == copId then
TriggerEvent('chatMessage', "", {255, 255, 255}, "^*" .. name .. " runs name, plate and other info in database, what comes back?")
elseif GetDistanceBetweenCoords(GetEntityCoords(GetPlayerPed(copId)), GetEntityCoords(GetPlayerPed(plyId)), true) < 49.999 then
TriggerEvent('chatMessage', "", {255, 255, 255}, "^*" .. name .. " runs name, plate and other info in database, what comes back?")
end
end)
Server
RegisterCommand("run", function(source, args, user)
local name = GetPlayerName(source)
TriggerClientEvent("proxRunInfo", -1, source, name)
end, false)
Ok i will update it, thanks alot for the help
No worries, the stringsplit function is really outdated, it is much easier just using the RegisterCommand native as @Syntasu suggested, the proximity just makes roleplay easier so you don’t have unnecessary messages across the entire server.
also could you send me what the contents of the __resource.lua file would be?
ummm… well since I sent server and client code, it would be client and server in the resource lua.
As i said im new, so could you send me the format please
Ok so i done it, but when i type the commands in game they just dont go through
You have done it incorrectly then.