SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 24/05/2010, 11:34 AM   #1
DevilRP
Big Clucker
 
Join Date: May 2010
Posts: 115
Reputation: 0
Default Respawn vehicles..

how can i make it so if i do a command i respawn all vehicles?
DevilRP is offline   Reply With Quote
Old 24/05/2010, 11:36 AM   #2
Jeffry
High-roller
 
Jeffry's Avatar
 
Join Date: Oct 2009
Location: Germany
Posts: 1,594
Reputation: 69
Default Re: Respawn vehicles..

pawn Code:
for(new i=0; i<MAX_VEHICLES; i++)
{
SetVehicleToRespawn(i);
}

Not tested, I dont know if it will work.
__________________
Jeffry is offline   Reply With Quote
Old 24/05/2010, 11:37 AM   #3
LTomi
Big Clucker
 
Join Date: Jan 2009
Posts: 115
Reputation: 0
Default Re: Respawn vehicles..

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
LTomi is offline   Reply With Quote
Old 24/05/2010, 11:38 AM   #4
DevilRP
Big Clucker
 
Join Date: May 2010
Posts: 115
Reputation: 0
Default Re: Respawn vehicles..

Thanks for the help guys, but how can i make it so only rcon admins can do that
?
DevilRP is offline   Reply With Quote
Old 24/05/2010, 11:40 AM   #5
LTomi
Big Clucker
 
Join Date: Jan 2009
Posts: 115
Reputation: 0
Default Re: Respawn vehicles..

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;
}
LTomi is offline   Reply With Quote
Old 24/05/2010, 11:42 AM   #6
Jeffry
High-roller
 
Jeffry's Avatar
 
Join Date: Oct 2009
Location: Germany
Posts: 1,594
Reputation: 69
Default Re: Respawn vehicles..

Wow, fast discussion, I was just testing it.
LTomi's code will work.
__________________
Jeffry is offline   Reply With Quote
Old 24/05/2010, 11:45 AM   #7
dice7
High-roller
 
Join Date: Apr 2009
Location: Slovenia
Posts: 2,200
Reputation: 22
Default Re: Respawn vehicles..

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
dice7 is offline   Reply With Quote
Old 24/05/2010, 11:46 AM   #8
DevilRP
Big Clucker
 
Join Date: May 2010
Posts: 115
Reputation: 0
Default Re: Respawn vehicles..

Thanks!
DevilRP is offline   Reply With Quote
Old 24/05/2010, 11:48 AM   #9
LTomi
Big Clucker
 
Join Date: Jan 2009
Posts: 115
Reputation: 0
Default Re: Respawn vehicles..

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.
LTomi is offline   Reply With Quote
Old 24/05/2010, 11:51 AM   #10
DevilRP
Big Clucker
 
Join Date: May 2010
Posts: 115
Reputation: 0
Default Re: Respawn vehicles..

edit, fixed it thanks!
DevilRP is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Respawn all vehicles BP13 Help Archive 5 10/12/2009 03:39 PM
Respawn nearby vehicles pziemczyk Help Archive 5 03/11/2009 06:54 PM
Specific vehicles respawn Sergei Help Archive 5 13/07/2009 09:07 PM
Respawn All Vehicles command. Badger(new) Help Archive 4 21/05/2009 10:41 PM
Vehicles don't respawn PoWerZ Help Archive 0 08/04/2009 08:48 AM


All times are GMT. The time now is 08:24 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.