This is a mode, which a crook tries to escape the cops. What I can't get to work is the leaveMarker function. A cylinder is attached to the crook when it spawns(it's suposed to be invisible, I didn't add the alpha thing yet tho), when the crook gets far away from the cops( all the cops) and they leave the marker, after 10 secs a message should appear, like "escaped" or something. And another thing I wanted to do is when the crook gets surrounded by the cops(another marker attached to the crook, a smaller one), wich when a cop stays within the marker, for atleast 10 secs, a message should appear, like "busted".
I would really appreciate your help! I just can't figure out what I'm suposed to do.
---this part works fine:
policeVehicles = { [416]=true,[574]=true, [433]=true, [427]=true, [490]=true, [528]=true, [407]=true, [544]=true, [523]=true, [470]=true, [598]=true, [596]=true, [597]=true, [599]=true, [432]=true, [601]=true, [428]=true, [497]=true, [510]=true, [564]=true}
function enterspawn (theVehicle, seat, jacked)
local copVehicle = ( policeVehicles[getElementModel(theVehicle)] )
if not copVehicle then
createBlipAttachedTo ( theVehicle, 55, 1 )
local name = getPlayerName ( source )
local r, g, b = getPlayerNametagColor ( source )
outputChatBox("***"..name.." is the crook***", getRootElement(), r, g, b, true )
local x, y, z = getElementPosition ( theVehicle )
local theMarker = createMarker ( x , y , z, "cylinder", 20, 255, 255, 0, 170 )
attachElements ( theMarker, theVehicle,0,0,0 )
else
cancelEvent()
end
end
addEventHandler ( "onPlayerVehicleEnter", getRootElement(), enterspawn )
---here doesn't, I don't understand why, I tried:
function MarkerLeave( leaveElement, matchingDimension )
if getElementType( leaveElement ) == "vehicle" and copVehicle
then
setTimer(MarkerLeave,10000,0, "escaped")
else cancelEvent()
end
end
addEventHandler( "onMarkerLeave",getRootElement(), MarkerLeave )function