Respawn vehicles..
#1

how can i make it so if i do a command i respawn all vehicles?
Reply
#2

pawn Code:
for(new i=0; i<MAX_VEHICLES; i++)
{
SetVehicleToRespawn(i);
}
Not tested, I dont know if it will work.
Reply
#3

pawn Code:
if(strcmp("/respawnallcars", cmdtext, true) == 0)
{
   for(new i = 0; i < MAX_VEHICLES; i++)
   {
     SetVehicleToRespawn(i);
   }
   return 1;
}
EDIT: Ahh, Jeffry was faster. :P
Reply
#4

Thanks for the help guys, but how can i make it so only rcon admins can do that
?
Reply
#5

pawn Code:
if(strcmp("/respawnallcars", cmdtext, true) == 0)
{
   if(IsPlayerAdmin(playerid))
   {
     for(new i = 0; i < MAX_VEHICLES; i++)
     {
        SetVehicleToRespawn(i);
     }
     SendClientMessage(playerid, COLOR_GREEN, "You have respawned all vehicles.");
   }
   else
   {
     SendClientMessage(playerid, COLOR_RED, "You are not an admin.");
   }
   return 1;
}
Reply
#6

Wow, fast discussion, I was just testing it.
LTomi's code will work.
Reply
#7

Slight edit:

pawn Code:
if(strcmp("/respawnallcars", cmdtext, true) == 0)
{
   if(IsPlayerAdmin(playerid))
   {
     for(new i = 1; i <= MAX_VEHICLES; i++)
     {
        SetVehicleToRespawn(i);
     }
     SendClientMessage(playerid, COLOR_GREEN, "You have respawned all vehicles.");
   }
   else
   {
     SendClientMessage(playerid, COLOR_RED, "You are not an admin.");
   }
   return 1;
}
since vehicle ids start with 1 and end with MAX_VEHICLES
Reply
#8

Thanks!
Reply
#9

Quote:
Originally Posted by dice7
Slight edit:

pawn Code:
if(strcmp("/respawnallcars", cmdtext, true) == 0)
{
  if(IsPlayerAdmin(playerid))
  {
     for(new i = 1; i <= MAX_VEHICLES; i++)
     {
       SetVehicleToRespawn(i);
     }
     SendClientMessage(playerid, COLOR_GREEN, "You have respawned all vehicles.");
  }
  else
  {
     SendClientMessage(playerid, COLOR_RED, "You are not an admin.");
  }
  return 1;
}
since vehicle ids start with 1 and end with MAX_VEHICLES
Yes, you are right.
Reply
#10

edit, fixed it thanks!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)