PDA

View Full Version : Respawn vehicles..


DevilRP
24/05/2010, 11:34 AM
how can i make it so if i do a command i respawn all vehicles?

Jeffry
24/05/2010, 11:36 AM
for(new i=0; i<MAX_VEHICLES; i++)
{
SetVehicleToRespawn(i);
}

Not tested, I dont know if it will work. :lol:

LTomi
24/05/2010, 11:37 AM
if(strcmp("/respawnallcars", cmdtext, true) == 0)
{
for(new i = 0; i < MAX_VEHICLES; i++)
{
SetVehicleToRespawn(i);
}
return 1;
}

EDIT: Ahh, Jeffry was faster. :P

DevilRP
24/05/2010, 11:38 AM
Thanks for the help guys, but how can i make it so only rcon admins can do that
?

LTomi
24/05/2010, 11:40 AM
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;
}

Jeffry
24/05/2010, 11:42 AM
Wow, fast discussion, I was just testing it.
LTomi's code will work. ;)

dice7
24/05/2010, 11:45 AM
Slight edit:

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

DevilRP
24/05/2010, 11:46 AM
Thanks!

LTomi
24/05/2010, 11:48 AM
Slight edit:

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.

DevilRP
24/05/2010, 11:51 AM
edit, fixed it thanks!

Alexy_Dramon
10/03/2012, 01:39 PM
Hmm try this
that only admin can Respawn cars
return 1;
}
if (strcmp("/RAC", cmdtext, true, 10) == 0)
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_RED, "You're not an Administrator.");
SandClientMessageToAll(playerid, COLOR_RED, "The unused Vehicles respawned now");
for(new i=0; i<MAX_VEHICLES; i++)
SetVehicleToRespawn(i)