When you trigger a client event from the server, it should be like this (‘eventname’, who, arg1, arg2, etc)
The ‘who’ is the player’s server id. That does not carry over to the client side function. It simply tells the server who to trigger it on. If you want it to trigger on everybody, use -1 (not in this case, but for future reference).
function CMD_sethp(source, args, help)
local arguments = argsToLocals(args)
if parseInput("ii",arguments) then
local zplayerID, zhealth = table.unpack(arguments)
zplayerID = tonumber(zplayerID)
zhealth = tonumber(zhealth)
TriggerClientEvent('chatMessage', source, '[ADMIN]', { 0, 255, 0 }, 'You have set ' .. zplayerID .. ' health to ' .. zhealth)
TriggerClientEvent('chatMessage', zplayerID, '[ALERT]', { 0, 255, 0 }, 'Your health has been set my an admin')
TriggerClientEvent('setThisGuysHP', zplayerID, zhealth)
else
TriggerClientEvent('chatMessage', source, '[GENERAL]', { 0, 255, 0 }, '/sethp [playername] [health]')
end
end
[code]RegisterNetEvent(“setThisGuysHP”)
AddEventHandler(“setThisGuysHP”, function(zhealth)
TriggerEvent('chatMessage', '[ADMIN]', { 0, 255, 0 }, 'msg from client file')
SetEntityHealth(GetPlayerPed(-1), zhealth)
end)[/code]
Have you tried anything like the above? Also, when you call a client event on the client, just use TriggerEvent. Don’t call TriggerClientEvent. That is for calling a client event from the server.
Edit: I’m testing this myself. I’ll edit/reply when/if I get it working.