Posts: 471
Threads: 97
Joined: Feb 2010
Reputation:
0
I need some help of that command beacause I don't really understand it.
I wanna make a command like when u /respawnallcars all the cars getting respawned, but if someone is in it, it won't respawn that car.
Could someone give me some help with that, or just the code?
suhrab_mujeeb
Unregistered
pawn Код:
// Top of script
forward PlayerInCar(vehicleid);
// ZCMD command, anywhere in the script not under a function or callback
CMD:respawnvehicles(playerid,params[])
{
vehicles<MAX_VEHICLES; vehicles++)
{
if(!PlayerInCar(vehicles))
{
SetVehicleToRespawn(vehicles);
}
}
return 1;
}
else return 0;
}
// Bottom of the script
public PlayerInCar(vehicleid)
{
for(new i=0;i<MAX_PLAYERS;i++)
{
if(IsPlayerInVehicle(i,vehicleid)) return 1;
}
return 0;
}
EDIT: funky was very fast. I recommend using his code rather than mine.
Posts: 471
Threads: 97
Joined: Feb 2010
Reputation:
0
Not working though, still re-spawning cars when players are in it.
suhrab_mujeeb
Unregistered
Quote:
Originally Posted by SomebodyAndMe
Nope, still respawning cars when a guy is inside it. Damn thing.
|
Quote:
Originally Posted by suhrab_mujeeb
pawn Код:
// Top of script forward PlayerInCar(vehicleid);
// ZCMD command, anywhere in the script not under a function or callback CMD:respawnvehicles(playerid,params[]) { vehicles<MAX_VEHICLES; vehicles++) { if(!PlayerInCar(vehicles)) { SetVehicleToRespawn(vehicles); } } return 1; } else return 0; } // Bottom of the script public PlayerInCar(vehicleid) { for(new i=0;i<MAX_PLAYERS;i++) { if(IsPlayerInVehicle(i,vehicleid)) return 1; } return 0; }
EDIT: funky was very fast. I recommend using his code rather than mine.
|
Have you tried this?