Respawn All Cars if hour == 16 - 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: Respawn All Cars if hour == 16 (
/showthread.php?tid=372000)
Respawn All Cars if hour == 16 -
CaTaLinU - 25.08.2012
PHP код:
for(new car = 1; car <= 303; car++)
{
if(!IsVehicleOccupied(car))
{
SetVehicleToRespawn(car);
SendClientMessage(i, COLOR_1RED, "{00ccff}[MnX]: {ffffff}All UnUsed cars have been respawned.");
}
}
How cand be made if world time is 16:00 to respawn all unused cars ?
Thanx
Re: Respawn All Cars if hour == 16 -
ddnbb - 25.08.2012
pawn Код:
new Hour, Minute, Second;
gettime(Hour, Minute, Second);
if(Hour == 16)
{
//Your script here
return 1;
}
Hope this helps
Re: Respawn All Cars if hour == 16 -
[MM]RoXoR[FS] - 25.08.2012
pawn Код:
public OnGameModeInit()
{
SetTimer("RespawnCars",1000,true);
return 1;
}
forward RespawnCars();
public RespawnCars()
{
new Hour, Minute, Second;
gettime(Hour, Minute, Second);
if(Hour == 16 && Minute == 0 && Second == 0)
{
for(new car = 1; car <= 303; car++)
if(!IsVehicleOccupied(car))
{
SetVehicleToRespawn(car);
}
SendClientMessageToAll(COLOR_1RED, "{00ccff}[MnX]: {ffffff}All UnUsed cars have been respawned.");
return 1;
}
return 0;
}
Re: Respawn All Cars if hour == 16 -
Universal - 25.08.2012
Quote:
Originally Posted by [MM]RoXoR[FS]
pawn Код:
public OnGameModeInit() { SetTimer("RespawnCars",1000,true); return 1; }
forward RespawnCars(); public RespawnCars() { new Hour, Minute, Second; gettime(Hour, Minute, Second); if(Hour == 16 && Minute == 0 && Second == 0) { for(new car = 1; car <= 303; car++) if(!IsVehicleOccupied(car)) { SetVehicleToRespawn(car); } SendClientMessageToAll(COLOR_1RED, "{00ccff}[MnX]: {ffffff}All UnUsed cars have been respawned."); return 1; } return 0; }
|
Setting a minute timer and checking if the minute is equal to 0 and hour to 16 would be more efficient than a second timer IMO.