GetTickCount() it's buggy?
#2

pawn Код:
if( PVeh[ slot ][ i ][ VehicleTimer ] < TimeNow )
Also, you don't really need to use GetTickCount if you're going to be using a timer in seconds anyway. You should use gettime() or actually use SetTimerEx to perform a despawn directly.

Example:
pawn Код:
// When you want to start the despawn timer.
PVeh[slot][i][VehicleTimer] = SetTimerEx("DespawnVehicle", DS_TIME, false, "ii", slot, i);

// When you want to cancel the despawn timer.
KillTimer(PVeh[slot][i][VehicleTimer]);

forward DespawnVehicle(slot, vehicle);
public DespawnVehicle(slot, vehicle)
{
    if( PVeh[ slot ][ vehicle ][ VehicleStatus ] == 1 )
    {
        #if defined DEBUG
            printf( "Vehicle[slot:%d] has been despanwned(C:%d / D:%d)", slot, GetTickCount( ), PVeh[ slot ][ i ][ VehicleTimer ] );
        #endif
        DeSpawnPlayerVehicle( slot, i );
        InfoTD_MSG( i, 7000, "~r~~h~Personal Vehicle~n~~w~~h~Your ~g~~h~%s(%d) ~w~~h~has been despawned~n~~y~~h~Reason: ~w~~h~1 minute out of activity", VehicleNames[ PVeh[ slot ][ i ][ VehicleModelID ] - 400 ], slot );
        return 1;
    }
    return 0;
}
The timer should probably be called under OnPlayerStateChange when the player leaves the vehicle.
Reply


Messages In This Thread
GetTickCount() it's buggy? - by nGen.SoNNy - 19.10.2015, 11:14
Re: GetTickCount() it's buggy? - by Threshold - 19.10.2015, 11:35
Re: GetTickCount() it's buggy? - by nGen.SoNNy - 19.10.2015, 12:10
Re: GetTickCount() it's buggy? - by Threshold - 19.10.2015, 13:53
Re: GetTickCount() it's buggy? - by PrO.GameR - 19.10.2015, 13:54
Re: GetTickCount() it's buggy? - by nGen.SoNNy - 19.10.2015, 14:07
Re: GetTickCount() it's buggy? - by PrO.GameR - 19.10.2015, 22:13
Re: GetTickCount() it's buggy? - by nGen.SoNNy - 19.10.2015, 22:26
Re: GetTickCount() it's buggy? - by PrO.GameR - 19.10.2015, 22:38
Re: GetTickCount() it's buggy? - by Threshold - 20.10.2015, 01:56

Forum Jump:


Users browsing this thread: 1 Guest(s)