Hi
Is there a way to cancel an event serverside by clientside ?
Like :
Serverside
AddEventHandler('mod:event123', function()
--My code
end)
Clientside
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
if (blablabla) then
--My code
TriggerServerEvent('mod:event123',arg)
else
CancelEvent('mod:event123')
end
end
end)
I missunderstood.
Uhm, I think you can’t, but try it ! 
If i ask, think i tried and failed, if i ask it’s for help.
Sorry, my intention wasn’t to disapoint you, just askin’ 
Uhm I never tried but I suppose if you can’t make cb between Client/Server, the answer is no
No worries, i just said why i write this.
I think it is not even possible, but if…maybe…
1 Like
But you can do it by another way, just let me know what you are tring to do
Simple,
In server side, there is an event with a function wich has a loop.
In client side, when you are in an specific area, it trigger the server event.
I want : if you go out the area, it cancel the server event.
I am not sure, but I think CancelEvent()
just works serverside, so you could try triggering a server event which cancels the other event.
Hum i’ll try but i did not see if we can set “arg” in the () of CancelEvent()
like
Event1
balbalba
Event2
CancelEvent(Event1)
If it’s possible, it’ll be fun
I’ll tomorrow
Check this out. Should clear things up
https://wiki.fivem.net/wiki/CancelEvent
Yep, i seen it before but what i wouldlike it a real exemple to really understand the concept.
Unfortunately I have no example, but if it isn’t solved till tomorrow evening I will take a look in it and try to figure it out.
What about check with a boolean the loop and set to false when the player get out the zone ?
But your system got a problem, if there is 2 players in the zone 
Put inside a table a bool for each player connected, then the client changes its own bool
1 Like
Btw this :
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
if (blablabla) then
--My code
TriggerServerEvent('mod:event123',arg)
else
CancelEvent('mod:event123')
end
end
end)
would cause a crash, cause you spam a server event with no delay… Your server is going to be overloaded
Good way to do that 
But you need to fetch with a for all usersBool each X seconds… How about lags ? 
Store client side the bool too,
check constantly client side,
if the bool changes its state then you trigger the server event.
The proper way to prevent lags, but not to prevent the security faillures