About exsplosives - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: About exsplosives (
/showthread.php?tid=269485)
About exsplosives -
Setkus - 16.07.2011
Oh, hey guys again!
This time I have a question about explosives. Is there any way for example i type /explosives and everywhere around me boom
And could I use this command after 10 min when I use it first time ?
Re: About exsplosives -
dowster - 16.07.2011
You could use the CreateExplosion function and GetTime. when a player does the command it does GetTime and sets a variable to the time. then the command checks to see if it is 10minutes past the time in the variable.
AW: About exsplosives -
Nero_3D - 16.07.2011
And for the explosions around you use random
pawn Код:
new
i,
Float: X,
Float: Y,
Float: Z;
GetPlayerPos(playerid, X, Y, Z);
for( ; i != 10; ++i) { // 10 explosions
CreateExplosion(
X + (random(2) ? (random(10) + 10.0) : (-(random(10) + 10.0))),
Y + (random(2) ? (random(10) + 10.0) : (-(random(10) + 10.0))),
Z, 0, 5.0);
}
You could also create any object, like a circle with the trigonometric functions
Re: About exsplosives -
Setkus - 16.07.2011
And is there any way that this I can use only in 10 mins jus one time ?
Re: About exsplosives -
=WoR=Varth - 17.07.2011
Just like dowster said. You can use GetTime,timer.
You have to make a boolean that check if it's already 10 minutes or not.
pawn Код:
new bool:already[MAX_PLAYERS]
forward enough(playerid);
CMD:blow(playerid,params[])
{
if(already[playerid] == false) return SendClientMessage(playerid,somecolor,"You have to wait 10 minutes");
CreateExplosion(...............);//Just like what Nero_3D said.
already[playerid] = true;
SetTimerEx("enough",600000,0,"d",playerid);
return 1;
}
public enough(playerid)
{
already[playerid] = false;
return 1;
}
Re: About exsplosives -
dowster - 17.07.2011
Quote:
Originally Posted by varthshenon
Just like dowster said. You can use GetTime,timer.
You have to make a boolean that check if it's already 10 minutes or not.
pawn Код:
new bool:already[MAX_PLAYERS]
forward enough(playerid);
CMD:blow(playerid,params[]) { if(already[playerid] == false) return SendClientMessage(playerid,somecolor,"You have to wait 10 minutes"); CreateExplosion(...............);//Just like what Nero_3D said. already[playerid] = true; SetTimerEx("enough",600000,0,"d",playerid); return 1; }
public enough(playerid) { already[playerid] = false; return 1; }
|
i have heard that using too many timers may be slow, i was thinking something like having the array be
Код:
LastExplodeTime[playerid]
and the check be
Код:
if (LastExplodeTime[playerid] > (GetTime() - 600)) SendClientMessage(playerid, 0xFF000000, "You have already used an explosion in the last ten minutes")
Re: About exsplosives -
Setkus - 17.07.2011
Thank you, guys! You really helped me!