Posts: 166
Threads: 13
Joined: Aug 2009
Reputation:
0
if(strcmp(cmd, "/respawnallcars", true) == 0 )
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] < 3)
{
SendClientMessage(playerid, COLOR_GRAD1, " you are not authorized to use that command!");
return 1;
}
new bool:unwanted[CAR_AMOUNT];
for(new player=0; player<MAX_PLAYERS; player++)
{
if(IsPlayerInAnyVehicle(player)) { unwanted[GetPlayerVehicleID(player)]=true; }
}
for(new car = 1; car <= 268; car++)
{
if(!unwanted[car]) SetVehicleToRespawn(car);
}
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "SERVER: All unused cars respawned by %s.", sendername);
BroadCast(COLOR_WHITE,string);
}
return 1;
}
Posts: 435
Threads: 24
Joined: Jun 2011
Reputation:
0
1.Create A variable like Unused[carid] or something like that
2.Create a timer of your choice , the time will be in how much time the vehicle becomes "unused"
3.In the timer function , set the unused variable to 1.
4.Go to OnPlayerExitVehicle and call the timer here.
5.Make command that will respawn all the vehicles that are unused
So like that vehicles without a driver will become unused after some time ( time defined by the timer )