/vrespawn help - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: /vrespawn help (
/showthread.php?tid=384156)
/vrespawn help -
Bullfr0g - 10.10.2012
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.
Re: /vrespawn help -
Camacorn - 10.10.2012
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;
}
Re: /vrespawn help -
SmithyComp - 10.10.2012
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.
Re: /vrespawn help -
Bullfr0g - 12.10.2012
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.
Re: /vrespawn help -
Lordzy - 12.10.2012
PHP код:
#define Seconds(%0) (%0*1000)
new vrtime;
CMD:vrespawn(playerid, params[])
{
new vsec;
if(sscanf(params,"i",vsec)) return SendClientMessage(playerid, 0xFF0000FF, "Usage: /vrespawn (seconds)");
if(vsec < 10) return SendClientMessage(playerid, 0xFF0000FF, "Seconds cannot be set below 10.");
for(new i = 0; i <MAX_PLAYERS; i++)
{
SetTimerEx("VehicleRespawn",Seconds(vsec),false,"d",i);
}
vrtime = vsec;
return 1;
}
forward VehicleRespawn()
public VehicleRespawn()
{
for(new i = 0; i <MAX_VEHICLES; i++)
{
for(new p = 0; p <MAX_PLAYERS; p++)
{
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(0xFF0000, string);
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
Re: /vrespawn help -
Bullfr0g - 12.10.2012
Okay thanks imma try that now
Re: /vrespawn help -
Bullfr0g - 13.10.2012
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