22.01.2013, 09:15
He's trying to ask for a timer that will not respawn cars, if they have not moved. You could try using something like this I guess:
Give it a shot, if it doesn't work on the first respawn, it will work for the rest.
EDIT: It's nice to see my name in a post
btw... this should be || not &&
pawn Код:
enum Vehicledata
{
Float:PosX,
Float:PosY,
Float:PosZ
}
new Vehicleinfo[MAX_VEHICLES][Vehicledata];
public OnVehicleSpawn(vehicleid)
{
new Float:x, Float:y, Float:z;
GetVehiclePos(vehicleid, x, y, z);
Vehicleinfo[vehicleid][PosX] = x;
Vehicleinfo[vehicleid][PosY] = y;
Vehicleinfo[vehicleid][PosZ] = z;
return 1;
}
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;
if(GetVehicleDistanceFromPoint(v, Vehicleinfo[v][PosX], Vehicleinfo[v][PosY], Vehicleinfo[v][PosZ]) <= 3.0) continue; //Change 3.0 if you want, this is just a slightly more accurate float.
SetVehicleToRespawn( v );
}
return 1;
}
EDIT: It's nice to see my name in a post
btw... this should be || not &&
pawn Код:
if( vehicles[ v ] == 1 || setspawn[v ] == 0 ) continue;