About exsplosives
#1

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 ?
Reply
#2

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.
Reply
#3

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
Reply
#4

And is there any way that this I can use only in 10 mins jus one time ?
Reply
#5

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;
}
Reply
#6

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")
Reply
#7

Thank you, guys! You really helped me!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)