spawn minigun every 1 hour? - 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: spawn minigun every 1 hour? (
/showthread.php?tid=469192)
spawn minigun every 1 hour? -
kbalor - 12.10.2013
I would like to make a global event like the title says Spawn Minigun. So when it hits 1 hour then give all online players a minugun and then after 3 minutes remove the minigun then spawn back the weapons of the players to original.
Is it possible?
Re: spawn minigun every 1 hour? -
PT - 12.10.2013
yes it is possible with a timer.
Re: spawn minigun every 1 hour? -
Zex Tan - 12.10.2013
^ Like what PT just said
Add a timer for an hour, when they spawned Minigun. Add a 30 min timer again, once removed. Call the 1 hour timer again.
Re: spawn minigun every 1 hour? -
matyi10012 - 12.10.2013
Код:
public OnGameModeInit()
{
SetTimer("MinigunSpawn",60*(60*1000), true);
return 1;
}
forward MinigunSpawn();
public MinigunSpawn()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
GivePlayerWeapon(playerid, 38, 10000);
}
SendClientMessageToAll(-1, "Minigun DM started. 3 minutes left");
SetTimer("RemoveMiniguns",3*(60*1000), false);
}
forward RemoveMiniguns();
public RemoveMiniguns()
{
new weapon, ammo;
for(new i = 0; i < MAX_PLAYERS; i++)
{
GetPlayerWeaponData(i, 7, weapon, ammo);
GivePlayerWeapon(i, 38, ammo*-1);
}
SendClientMessageToAll(-1, "Minigun DM ended.");
}
Actually I didn't test it, but I think it will work.
First it starts an 1 hour timer, when the timer reaches zero it gives minigun to all players.
After 3 minutes it removes miniguns from the players.