29.03.2017, 14:48
Hello,
I stumbled over some weird issue while using y_timers. I'm making a system that despawns a player's vehicle after 15 minutes if he doesn't come back on the server, and I thought about making a timer with y_timers. Ok, it works and everything, but if the player comes back and I do "stop" or "KillTimer" over the pre-mentioned timer, it actually runs the code inside the timer. Thanks in advance.
Here you have the code:
timer:
stop:
I stumbled over some weird issue while using y_timers. I'm making a system that despawns a player's vehicle after 15 minutes if he doesn't come back on the server, and I thought about making a timer with y_timers. Ok, it works and everything, but if the player comes back and I do "stop" or "KillTimer" over the pre-mentioned timer, it actually runs the code inside the timer. Thanks in advance.
Here you have the code:
timer:
pawn Код:
timer DespawnPVeh[900000]( vehid, vehslot, string:playername[ ] ){
new
Float: vehhp ;
GetVehicleHealth( vehid, vehhp ) ;
p_VehicleData[ vehid ][ HP ] = vehhp ;
SavePVeh( playername, vehid, vehslot ) ;
enginestatus[ vehid ] = 0 ;
stlights[ vehid ] = 0 ;
DestroyVehicle( vehid ) ;
print( "Debug: DespawnPVeh executed succesfully after 900,000ms." ) ;
}
pawn Код:
stop DespawnPVeh( PlayerData[ playerid ][ SpawnedVeh ], slotspawned[ playerid ], GetName( playerid ) )
or KillTimer( DespawnPVeh( PlayerData[ playerid ][ SpawnedVeh ], slotspawned[ playerid ], GetName( playerid ) ) ) ;