22.01.2013, 08:34
Hello there !
I got a problem :
I tried to look for something to help to respawn unused cars every X minuts (the player leave his car on the road, then after X minuts it respawn).
So I found this code by BenzoAMG :
So I putted
on public OnGameModeInit() but this isn't working at all, the vehicule that is unused doesn't respawn after 5 seconds.
Can you please tell me what is wrong here ? The SetTimer place ?
I got a problem :
I tried to look for something to help to respawn unused cars every X minuts (the player leave his car on the road, then after X minuts it respawn).
So I found this code by BenzoAMG :
pawn Код:
// Somewhere, like in a command
SetTimer( "RespawnVehicles", 5000, false ); // Change '5000' to make a different delay
// After main( )
forward RespawnVehicles( );
public RespawnVehicles( )
{
new vehicles[ MAX_VEHICLES ];
for( new i = 0; i < MAX_PLAYERS; i ++ )
{
if( IsPlayerInAnyVehicle( i ) )
{
vehicles[ GetPlayerVehicleID( i ) ] = 1;
}
}
for( new v = 0; v < MAX_VEHICLES; v ++ )
{
if( vehicles[ v ] == 1 ) continue;
SetVehicleToRespawn( v );
}
return 1;
}
So I putted
pawn Код:
SetTimer( "RespawnVehicles", 5000, false ); // Change '5000' to make a different delay
Can you please tell me what is wrong here ? The SetTimer place ?