/vrespawn help
#1

Guys, I'm looking for a /vrespawn [time] command. It actually respawns all vehicles currently in the server after the specified time (in seconds). I once found the codes in the forum doing the same but I can't find it anymore. Please be kind enough to link me to that topic or code a new one.

Thanks in advance.
Reply
#2

Use the following command, but add a timer to it.

pawn Код:
CMD:vrespawn(playerid, params[])
{
    for(new cars=0; cars<MAX_VEHICLES; cars++)
    {
        if(!VehicleOccupied(cars))
        {
            SetVehicleToRespawn(cars);
        }
    }
    SendClientMessageToAll(white, "All unoccupied vehicles have been respawned!");
    return 1;
}
Reply
#3

Quote:
Originally Posted by Camacorn
Посмотреть сообщение
Use the following command, but add a timer to it.

pawn Код:
CMD:vrespawn(playerid, params[])
{
    for(new cars=0; cars<MAX_VEHICLES; cars++)
    {
        if(!VehicleOccupied(cars))
        {
            SetVehicleToRespawn(cars);
        }
    }
    SendClientMessageToAll(white, "All unoccupied vehicles have been respawned!");
    return 1;
}
He wanted it on a specific timer... He needs to define some more stuff.
Reply
#4

Yeah, the time has to be set IG via the /vrespawn command. I know to do the remaining stuff, but I don't have a clue on how to do the timers.
Reply
#5

PHP код:
#define Seconds(%0) (%0*1000)
new vrtime;
CMD:vrespawn(playeridparams[])
{
  new 
vsec;
  if(
sscanf(params,"i",vsec)) return SendClientMessage(playerid0xFF0000FF"Usage: /vrespawn (seconds)");
  if(
vsec 10) return SendClientMessage(playerid0xFF0000FF"Seconds cannot be set below 10.");
  for(new 
0<MAX_PLAYERSi++)
  {
   
SetTimerEx("VehicleRespawn",Seconds(vsec),false,"d",i);
  } 
  
vrtime vsec;
  return 
1;
}
forward VehicleRespawn()
public 
VehicleRespawn()
{
  for(new 
0<MAX_VEHICLESi++)
  {
    for(new 
0<MAX_PLAYERSp++)
    {
     if(!
IsPlayerInAnyVehicle(p))
     {
      
SetVehicleToRespawn(i);
      new 
string[128];
      new 
gstr[60];
      
format(string,sizeof(string),"All empty vehicles has been respawned!");
      
format(gstr,sizeof(gstr),"~r~] VEHICLES ~g~RESPAWNED ~r~ ]");
      
SendClientMessageToAll(0xFF0000string);
      
GameTextForAll(gstr,3000,3);
      
SetTimerEx("VehicleRespawn",Seconds(vrtime),false,"d",p); 
     }
    }
   }
  return 
1;

You need sscanf2 and zcmd.

Btw this isn't tested, I just created now through mobile
Reply
#6

Okay thanks imma try that now
Reply
#7

No, that didn't work out well. All it did was spam the server with "All empty vehicles has been respawned!". And it re-spawned occupied vehicles as well.

Sorry for dub post
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)