SA-MP Forums Archive
Need a Little Help in This CMD (rep+++++) - 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: Need a Little Help in This CMD (rep+++++) (/showthread.php?tid=338546)



Need a Little Help in This CMD (rep+++++) - iOmar - 30.04.2012

Guys i have this CMD..

pawn Код:
COMMAND:airstrike(playerid, params[])
{
    if(GetPlayerScore(playerid) < 2000) return SendClientMessage(playerid, 0xFF0000FF, "You don't have enough score, you need 2000 score");
    if(GetPlayerMoney(playerid) < 10000) return SendClientMessage(playerid, 0xFF0000FF, "You don't have enough money.");
    GivePlayerMoney(playerid,-10000);
    SendClientMessage(playerid, 0xFF0000FF, "Air Strike Successfully Done!");
    SetTimerEx("ExplodeBomb", 5000, false, "i", playerid);
    return 1;
}
public ExplodeBomb(playerid)
{
    new Float: Pos[3];
    GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
    CreateExplosion(Pos[0], Pos[1], Pos[2], 7, 20.0);
    return 1;
}
====> When i type /airstrike it explode after 5 sec (thats what i need) but it do not explode on the position where i was standing but explode on me... Please i need that it explodes on the position where i type /airstrike that is where i was standing last....


Re: Need a Little Help in This CMD (rep+++++) - antonio112 - 30.04.2012

pawn Код:
COMMAND:airstrike(playerid, params[])
{
    if(GetPlayerScore(playerid) < 2000) return SendClientMessage(playerid, 0xFF0000FF, "You don't have enough score, you need 2000 score");
    if(GetPlayerMoney(playerid) < 10000) return SendClientMessage(playerid, 0xFF0000FF, "You don't have enough money.");
    GivePlayerMoney(playerid,-10000);
    new Float:Pos[3];
    GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
    SendClientMessage(playerid, 0xFF0000FF, "Air Strike Successfully Done!");
    SetTimerEx("ExplodeBomb", 5000, false, "ifff", playerid, Pos[0], Pos[1], Pos[2]);
    return 1;
}
public ExplodeBomb(playerid, Float:PosX, Float:PosY, Float:PosZ)
{
    CreateExplosion(PosX, PosY, Z, 7, 20.0);
    return 1;
}
This should work.


Re: Need a Little Help in This CMD (rep+++++) - iOmar - 30.04.2012

Giving these errors........

pawn Код:
D:\Game\SA-MP Files\SF Wars\gamemodes\Wars.pwn(1217) : error 025: function heading differs from prototype
D:\Game\SA-MP Files\SF Wars\gamemodes\Wars.pwn(1219) : error 017: undefined symbol "Z"
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


2 Errors.



Re: Need a Little Help in This CMD (rep+++++) - fordawinzz - 30.04.2012

pawn Код:
CreateExplosion(PosX, PosY, PosZ, 7, 20.0);



Re: Need a Little Help in This CMD (rep+++++) - Youice - 30.04.2012

Quote:
Originally Posted by iOmar
Посмотреть сообщение
====> When i type /airstrike it explode after 5 sec (thats what i need) but it do not explode on the position where i was standing but explode on me... Please i need that it explodes on the position where i type /airstrike that is where i was standing last....
You have scripted the positions(floats) on the player not near or beside him!!

Код:
CreateExplosion(PosX, PosY, PosZ, 7, 20.0);

PosX, PosY, PosZ = positions(floats) you know that already!

This "7" is the type of bomb "TYPES"

This "20.0" Is the explosion radius.



Re: Need a Little Help in This CMD (rep+++++) - iOmar - 30.04.2012

so how can i dot it??
pawn Код:
D:\Game\SA-MP Files\SF Wars\gamemodes\Wars.pwn(1217) : error 017: undefined symbol "PosX"
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


1 Error.



Re: Need a Little Help in This CMD (rep+++++) - Youice - 30.04.2012

Код:
public ExplodeBomb(playerid)
{
    new Float:PosX, Float:PosY, Float:PosZ;
    CreateExplosion(PosX, PosY, PosZ, 7, 20.0);
    return 1;
}
It is the same but in other way(I compiled it and it worked without receiving any errors or warnings)


Re: Need a Little Help in This CMD (rep+++++) - iOmar - 30.04.2012

I did this. Is is giving this error:
pawn Код:
D:\Game\SA-MP Files\SF Wars\gamemodes\Wars.pwn(1216) : error 017: undefined symbol "Z"
D:\Game\SA-MP Files\SF Wars\gamemodes\Wars.pwn(1215) : warning 203: symbol is never used: "PosZ"
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


1 Error.
And when i try to add "PosZ" than it compile fine but in game nothing happens??


Re: Need a Little Help in This CMD (rep+++++) - Youice - 30.04.2012

Quote:
Originally Posted by iOmar
Посмотреть сообщение
I did this. Is is giving this error:
pawn Код:
D:\Game\SA-MP Files\SF Wars\gamemodes\Wars.pwn(1216) : error 017: undefined symbol "Z"
D:\Game\SA-MP Files\SF Wars\gamemodes\Wars.pwn(1215) : warning 203: symbol is never used: "PosZ"
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


1 Error.
And when i try to add "PosZ" than it compile fine but in game nothing happens??
you tried my code?


Re: Need a Little Help in This CMD (rep+++++) - antonio112 - 30.04.2012

Quote:
Originally Posted by Youice
Посмотреть сообщение
Код:
public ExplodeBomb(playerid)
{
    new Float:PosX, Float:PosY, Float:PosZ;
    CreateExplosion(PosX, PosY, PosZ, 7, 20.0);
    return 1;
}
It is the same but in other way(I compiled it and it worked without receiving any errors or warnings)
No offence but you have no idea what you're doing. Let's analyze your code. So, you create 3 new floats, which, by creation are 0.0; 0.0; 0.0. And now you create an explosion at those coordinates. Cool. Why do you even need the 'playerid' param in the function ?

pawn Код:
COMMAND:airstrike(playerid, params[])
{
    if(GetPlayerScore(playerid) < 2000) return SendClientMessage(playerid, 0xFF0000FF, "You don't have enough score, you need 2000 score");
    if(GetPlayerMoney(playerid) < 10000) return SendClientMessage(playerid, 0xFF0000FF, "You don't have enough money.");
    GivePlayerMoney(playerid,-10000);
    new Float:Pos[3];
    GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
    SendClientMessage(playerid, 0xFF0000FF, "Air Strike Successfully Done!");
    SetTimerEx("ExplodeBomb", 5000, false, "ifff", playerid, Pos[0], Pos[1], Pos[2]);
    return 1;
}
forward ExplodeBomb(playerid, Float:PosX, Float:PosY, Float:PosZ);
public ExplodeBomb(playerid, Float:PosX, Float:PosY, Float:PosZ)
{
    SendClientMessage(playerid, -1, "BOOOOOOM! ! ! !");
    CreateExplosion(PosX, PosY, PosZ, 7, 20.0);
    return 1;
}

This should work.