Hello guys its me again, i have some bull:~ problem.
I cant trigger a client event, and i dont know why, because normally i can.. Sorry for my bad english, im not the best.
So the problem. Im making an event system to my server on my own way, like "TDM" or "Race" events. In the test now, i can start it with /testrace comamnd, then something happens to all players on the server, because i only do test it with my best friend, so we 2 guys on the server and no more.
Everything good, only the Client side event isnt triggered. But what is wrong? Because no errors in the server's command line.
I want to do, when i use a command, a client side event do runs for all online player.
What do i do wrong?
Script_serverside:
local racer_players = {
}
function testrace(player, command)
local players = getElementsByType ( "player" )
for theKey,thePlayer in ipairs(players)
triggerClientEvent("raceCevent", thePlayer) -- Only this isnt running!
outputChatBox("for thePlayer", thePlayer, 255, 0, 0)
table.insert( racer_players, theKey, thePlayer)
end
outputChatBox("Server script is working further..", player, 255, 0, 0)
triggerEvent("race_start", root)
end
addCommandHandler('race', testrace)
addEvent( "race_start", true )
addEventHandler( "race_start", root, function()
outputChatBox("race_start event is triggered", player, 255, 0, 0)
for theKey,thePlayer in ipairs(racer_players) do
--I do some script here, doesnt matters
end
end)
Script_clientside
addEvent("raceCevent", true)
addEventHandler("raceCevent", localPlayer, function()
outputChatBox("raceCevent is triggered!", 0, 255, 0)
end)
On the server: https://prnt.sc/7Fb8rWxxSjbo
No errors in the command line.
What is bad?
Thanks for help guys!
- Father