Transport respawn delay - 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: Transport respawn delay (
/showthread.php?tid=394704)
Transport respawn delay -
Frapsy - 23.11.2012
There is a moped, it exploded. How can I make a car respawn after a certain time?
Re: Transport respawn delay -
GordonP - 23.11.2012
Create a respawning command, such as:
Код:
CMD:respawn(playerid, params[])
{
new string[128], veh;
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
if(PlayerInfo[playerid][pAdmin] < 4) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
if(!strcmp(params, "all", true))
{
for(new i=0; i<MAX_VEHICLES; i++)
{
if(i != NPCBus)
{
new vehs;
foreach(Player, x)
{
if(GetPlayerVehicleID(x) == i)
{
vehs = 1;
}
}
if(!vehs)
{
SetVehicleToRespawn(i);
}
vehs = 0;
}
}
format(string, sizeof(string), "AdmCmd: %s has respawned all unused vehicles.", RPN(playerid));
SendClientMessageToAll(COLOR_LIGHTRED, string);
return 1;
}
if(sscanf(params, "i", veh)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /respawn [vehicleid/all]");
SetVehicleToRespawn(veh);
format(string, sizeof(string), "AdmWarn: %s has respawned vehicle ID %d.", RPN(playerid), veh);
SendAdminMessage(COLOR_DARKRED, 1, string);
return 1;
}
+Rep!
Re: Transport respawn delay -
Frapsy - 23.11.2012
You are not properly understood. Vehicles should spawn automatically after a certain time after the "death". That's what I need.
Re: Transport respawn delay -
YoYo123 - 23.11.2012
Set a timer in OnVehicleDeath and add SetVehicleToRespawn(vehicleid);
Re: Transport respawn delay -
Frapsy - 23.11.2012
This is what is fit, thank you.