Hi guys who are seeing my topic . I’m developing a chat script for ESX Framework. I need help because I have a problem when I put /me or /do command. I did this two commands how a local chat for all players of my server but they doesn’t work well. When I use them the cmd of the server shows me this error:
The code that I wrote is this:
Server.lua
RegisterServerEvent("localme")
AddEventHandler("localme", function(id, args)
local weid = GetPlayerFromIdentifier(source)
local hisid = GetPlayers()
if weid == hisid then
print("^7[^1ME^7]:" .. args)
TriggerClientEvent("chatMessage", -1, "^7[^1ME^7]", {0,0,0}, args)
elseif GetDistanceBetweenCoords(GetEntityCoords(GetPlayerPed(weid)), GetEntityCoords(GetPlayerPed(hisid)), true) < 19.999 then
print("^7[^1ME^7]:" .. args)
TriggerClientEvent("chatMessage", -1, "^7[^1ME^7]", {0,0,0}, args)
end
end)
RegisterServerEvent("localdo")
AddEventHandler("localdo", function(id, args)
local weid = GetPlayerFromIdentifier(source)
local hisid = GetPlayers()
if weid == hisid then
print("^7[^8DO^7]:" .. args)
TriggerClientEvent("chatMessage", -1, "^7[^8DO^7]", {0,0,0}, args)
elseif GetDistanceBetweenCoords(GetEntityCoords(GetPlayerPed(weid)), GetEntityCoords(GetPlayerPed(hisid)), true) < 19.999 then
print("^7[^8DO^7]:" .. args)
TriggerClientEvent("chatMessage", -1, "^7[^8DO^7]", {0,0,0}, args)
end
end)
Client.lua
RegisterCommand("me", function(source, args)
TriggerServerEvent("localme", table.concat(args, " "))
end)
RegisterCommand("do", function(source, args)
TriggerServerEvent("localdo", table.concat(args, " "))
end)
Can anyone helps me, please??