Hey there, i am making a few scripts for a new server, and I am trying to create a “fix me” script, so that players can teleport to a set location for a small fee if they are stuck inside of a building.
To stop any sort of powergaming, like using the system to teleport away from police, i would like to add a feature where when the command is entered, there is a chat message send to every player on the server showing which player id executed the command
Here is my current client sided code:
local playerIdMSG = GetPlayerServerId(PlayerId())
RegisterCommand("fixmepls", function(source, args, raw)
local coords = GetEntityCoords(PlayerPedId())
local ped = GetPlayerPed(-1)
FreezeEntityPosition(ped,true)
FreezeEntityPosition(ped,false)
SetEntityVisible(ped,false,false)
SetEntityVisible(ped,true,false)
SetEntityProofs(GetPlayerPed(-1),false,false,false,false,false,false,1,false)
SetEntityCoords(ped, 10.0657, 6511.2822, 31.87, 1, 0, 0, 1)
TriggerEvent('chatMessage', "SYSTEM", {255, 0, 0}, " ^3Invoice of ^1$800^3 for using /fixmepls")
TriggerServerEvent('esx_billing:sendBill', GetPlayerServerId(PlayerId()), 'society_police', 'Use of /fixmepls', 800) -- Sends a bill from the police
end)
And here is the chat message i would like displayed on every player’s chat when the /fixmepls command is executed
TriggerEvent('chat:addMessage', {
color = { 255, 0, 0},
args = {"SYSTEM", "^3Player ID ^3[^1" ..playerIdMSG .. "^3] used /fixmepls"}
})
Thank you for your help,
daynios