[SOLVED]Airstrike script.
#1

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

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

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

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

Thanks man, I got it working now
Moderator can lock this.
Reply
#6

Hey, No propblem at at.. thats why we have forums, to help eachother
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)