20.02.2016, 02:43
You should use
instead of just using if statements.
This is what's happening with your code.
Enters callback with checkpointid being 15
if(checkpointid == DrivingCheck[playerid][1])
-> checkpointid (value of 15) == DrivingCheck[playerid][0] (value of 15) is true so enters code block
->-> destroy checkpoint (next checkpoint created will be id 15 again)
->-> DrivingCheck[playerid][2] = CreateCP(..) //recreate checkpoint (returns id 15)
->->-> leaves if statement..
if(checkpointid == DrivingCheck[playerid][2]) // checkpointid is 15 and so is the value of DrivingCheck[playerid][2] because of the returned value from CreateCP(..).
repeat until the end.
Hope that makes sense xD
pawn Код:
if (..)
else if(..)
else if(..)
This is what's happening with your code.
Enters callback with checkpointid being 15
if(checkpointid == DrivingCheck[playerid][1])
-> checkpointid (value of 15) == DrivingCheck[playerid][0] (value of 15) is true so enters code block
->-> destroy checkpoint (next checkpoint created will be id 15 again)
->-> DrivingCheck[playerid][2] = CreateCP(..) //recreate checkpoint (returns id 15)
->->-> leaves if statement..
if(checkpointid == DrivingCheck[playerid][2]) // checkpointid is 15 and so is the value of DrivingCheck[playerid][2] because of the returned value from CreateCP(..).
repeat until the end.
Hope that makes sense xD