Admin Car Re spawner
#1

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.
Reply
#2

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;
}
Reply
#3

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


Forum Jump:


Users browsing this thread: 1 Guest(s)