Citizen.CreateThread ignoring wait

Trying to make a scrip that not only catches cheaters, but embarrasses them too. The script works, excpt for one issue; the Wait command gets ignored regardless of where I put it. Once I announce the player cheated and kill them, to keep them from ruing the experience of others, I want the invincible check to delay to give the player time to turn off invincibility in their trainer. The player is killed and the announcement is made, but every tick, and the player looses control of the trainer. Not quite going to go over too well with players.

I know we can turn off scripthookv, and we eventually will. We can’t do that until we have all the player skins accessible through an alternative manner. Even then, cheaters are getting pretty sophisticated, so we will want more layers of protection then just turning off script hook.

Thanks for any help.

What I have so far:

Citizen.CreateThread(function()
– get the player info
playerPed = GetPlayerPed(-1)
playerid = PlayerId()
playername = GetPlayerName(playerid)

while true do
Wait(1)
if not canbeinvincible then
if (GetPlayerInvincible(playerid)) then
SetPlayerInvincible(playerid, false)
killmessage = playername … " got caught being invincible."
TriggerServerEvent(“ZA:BroadcastMessage”, killmessage)
SendNUIMessage({
playsound = “termination.ogg”,
soundvolume = volume
})
SetEntityHealth(GetPlayerPed(-1), 1)
Wait(500) <---- DOES NOT HAPPEN
end
end
–SetPlayerInvincible(playerid, false)
CheckPlayerCar()
end
end)

That’s 500ms - half a second. I don’t think you will notice a 500ms wait.

@GeekRiot set up an admin system and check out simple PED editor v1.0. One cannot cheat if code doesn’t allow it.

Try to use Citizen.Wait(ms)

Wait is a alias of Citizen.Wait

My problem is simple: wait using milliseconds. Um…duh. I don’t know of any programming language where wait is not milliseconds. So, I bumped up the wait number and now I get what I want.

Thanks everyone.

No problem man :smiley:.