[Lua] AddEventHandler not working

lua

#1

Now fixed. There was a collection of syntax errors. Check your elseifs kids!


#2

Why are you using CreateThread?


#3

As I’m inexperienced, I’ve effectively used a similar door lock script for reference. From what I could see CreateThread would stop your script blocking any other running scripts, or am I incorrect?


#4

Not if the code is executed fast enough, what I see here it isn’t needed.


#5

Ah ok, I’ll remove it, which I did do to try to fix, but it still didn’t seem to remedy the situation.


#6

Ow didn’t say it would fix it, I was just curious as to why it was there.


#7

Haha fair enough, if i’m honet, it was just lack of knowing. I’m curious though as to why the EventHandler doesn’t sem to be getting triggered. I’ve looked over countles other posts of ‘similar’ issues and most have fogotten to ad the source param. I cannot see whats wrong with mine!


#8

Think its just the wrong function you’re calling on the client :wink: Try using Citizen.Trace instead and, the messages should be printed to your F8 console.


#9

Ah silly me!

Still doesn’t seem to be triggering though!


#10

Despite adding a citizen.tace function under the eventHandler, it still is not coming up, so the event is obviously not triggering. I cannot see what might be causing this?!