Automatic respawn for unused vehicules.
#1

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 :

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
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 ?
Reply


Messages In This Thread
Automatic respawn for unused vehicules. - by Kethrios - 22.01.2013, 08:34
Re: Automatic respawn for unused vehicules. - by _Mohit_ - 22.01.2013, 08:37
Re: Automatic respawn for unused vehicules. - by _Mohit_ - 22.01.2013, 08:40
Re: Automatic respawn for unused vehicules. - by Jewell - 22.01.2013, 08:44
Re : Automatic respawn for unused vehicules. - by Kethrios - 22.01.2013, 08:45
Re: Automatic respawn for unused vehicules. - by _Mohit_ - 22.01.2013, 08:45
Re: Automatic respawn for unused vehicules. - by Jewell - 22.01.2013, 08:47
Re: Automatic respawn for unused vehicules. - by Jewell - 22.01.2013, 09:00
Re : Re: Automatic respawn for unused vehicules. - by Kethrios - 22.01.2013, 09:14
Re: Automatic respawn for unused vehicules. - by Threshold - 22.01.2013, 09:15

Forum Jump:


Users browsing this thread: 2 Guest(s)