[SOLVED]Airstrike script. -
Rzzr - 24.09.2009
Ok, I have this airstrike script.
The code:
pawn Код:
//On top of my GM
forward strike(playerid);
pawn Код:
//The command
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp(cmdtext, "/airstrike", true)==0)
{
SetTimerEx("strike", 7000, false, "i", playerid);
SendClientMessage(playerid, 0xFFFFFFAA, "Airstrike on your position in 7 seconds!");
return 1;
}
return 0;
}
pawn Код:
// And this
public strike(playerid)
{
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
CreateExplosion(X, Y, Z, 7, 100);
CreateExplosion(X+5, Y, Z, 7, 100);
CreateExplosion(X, Y+5, Z, 7, 100);
CreateExplosion(X-5, Y, Z, 7, 100);
CreateExplosion(X, Y-5, Z, 7, 100);
CreateExplosion(X+10, Y, Z, 7, 100);
CreateExplosion(X, Y+10, Z, 7, 100);
}
But now it 'drops' the airstrike on the position where the player is AFTER the 7 seconds, but i want the airstrike to be dropped on the position where the player is BEFORE the 7 seconds. Any1 knows how i can do this?
Thanks in advantage.
Re: Airstrike script. -
Paladin - 24.09.2009
pawn Код:
//The command
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp(cmdtext, "/airstrike", true)==0)
{
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
CreateExplosion(X, Y, Z, 7, 100);
CreateExplosion(X+5, Y, Z, 7, 100);
CreateExplosion(X, Y+5, Z, 7, 100);
CreateExplosion(X-5, Y, Z, 7, 100);
CreateExplosion(X, Y-5, Z, 7, 100);
CreateExplosion(X+10, Y, Z, 7, 100);
CreateExplosion(X, Y+10, Z, 7, 100);
SendClientMessage(playerid, 0xFFFFFFAA, "Airstrike on your position in 7 seconds!");
return 1;
}
return 0;
}
Uhm dude... if you want it to drop before 7 seconds, then there is no point in using a timer because then your timer would be blank. Did I misunderstand something?
Re: Airstrike script. -
Rzzr - 24.09.2009
I think u misunderstood wrong :P
The 'bombs' have to be dropped on the position where the player is when he does /airstrike.
Then he has 7 seconds to get out of there, because else he would be killed by his own airstrike.
Re: Airstrike script. -
TMasters - 24.09.2009
The code:
pawn Код:
//On top of my GM
forward strike(playerid,Float:cX,Float:cY,Float:cZ);
pawn Код:
//The command
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp(cmdtext, "/airstrike", true)==0)
{
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
SetTimerEx("strike", 7000, false, "ifff", playerid,X,Y,Z);
SendClientMessage(playerid, 0xFFFFFFAA, "Airstrike on your position in 7 seconds!");
return 1;
}
return 0;
}
pawn Код:
// And this
public strike(playerid,cX,cY,cZ)
{
CreateExplosion(cX, cY, cZ, 7, 100);
CreateExplosion(cX+5, cY, cZ, 7, 100);
CreateExplosion(cX, cY+5, cZ, 7, 100);
CreateExplosion(cX-5, cY, cZ, 7, 100);
CreateExplosion(cX, cY-5, cZ, 7, 100);
CreateExplosion(cX+10, cY, cZ, 7, 100);
CreateExplosion(cX, cY+10, cZ, 7, 100);
}
Something like that should work
didnt test it but thats the thing,
minor error reports could be fixed if you know how to script, i didnt write it carefully
Re: Airstrike script. -
Rzzr - 25.09.2009
Thanks man, I got it working now
Moderator can lock this.
Re: [SOLVED]Airstrike script. -
TMasters - 25.09.2009
Hey, No propblem at at.. thats why we have forums, to help eachother