SA-MP Forums Archive
Admin Car Re spawner - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Admin Car Re spawner (/showthread.php?tid=135129)



Admin Car Re spawner - Josh_Kerns - 19.03.2010

Hello everyone. I need some help. How do i create a command for a Admin were i can re spawn all the cars in my game. Please help me.


Re: Admin Car Re spawner - Virtual1ty - 19.03.2010

under OnPlayerCommandText
pawn Код:
if(strcmp(cmd, "/respawnallvehicles", true) == 0 || strcmp(cmd, "/respvehs", true) == 0)
    {
      if(IsPlayerAdmin(playerid))
      {
            for(new i = 0; i < MAX_VEHICLES; i++)
            {
                if(IsVehicleOccupied(i) == 0)
                {
                SetVehicleToRespawn(i);
              }
            }
            SendClientMessage(playerid, 0xAFAFAFAA, "*      All unoccupied vehicles respawned!!");
        }
        return 1;
    }
somewhere in the script:

pawn Код:
forward IsVehicleOccupied(vehicleid);
public IsVehicleOccupied(vehicleid)
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerInVehicle(i, vehicleid)) return 1;
    }
    return 0;
}



Re: Admin Car Re spawner - Josh_Kerns - 19.03.2010

That didn`t work. Compiles fine but then when i go to type the commands nothing happens.