SA-MP Forums Archive
Why am i getting errors - 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: Why am i getting errors (/showthread.php?tid=360154)



Why am i getting errors - Euan Hughes - 16.07.2012

So i tried to do a /c4 command but i kept getting errors and i dont understand why

pawn Код:
BombPos;
pawn Код:
command(c4, playerid, params[]) {
        new
                Float:BombPosx,
                Float:BombPosy,
                Float:BombPosz;
        if(Player[playerid][Group] == 2)
        {
            if(Player[playerid][C4] == 0)
            {
                                GetPlayerPos(playerid, BombPosx, BombPosy, BombPosz);
                                Player[playerid][C4] = 1;
                ApplyAnimationEx(playerid, "BOMBER", "BOM_Plant", 3.1, 0, 1, 1, 1, 1);
                TogglePlayerControllable(playerid, true);
                SendClientMessage(playerid, WHITE, "You have planted a C4.");
               ERROR > Player[playerid][BombPos][0] = BombPosx;
                Player[playerid][BombPos][1] = BombPosy;
                Player[playerid][BombPos][2] = BombPosz;
                CreatePlayer3DTextLabel(playerid, "Bomb Planted", RED, Player[playerid][BombPos][0],Player[playerid][BombPos][1], Player[playerid][BombPos][2], 1000, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1);
            }
                else if(Player[playerid][C4] == 1)
                {
                        if(IsPlayerInRangeOfPoint(playerid, 5, Player[playerid][BombPos][0], Player[playerid][BombPos][1], Player[playerid][BombPos][2]))
                        {
                                ApplyAnimationEx(playerid, "BOMBER", "BOM_Plant", 3.1, 0, 1, 1, 1, 1);
                        TogglePlayerControllable(playerid, true);
                        SendClientMessage(playerid, WHITE, "You have picked your C4 up.");
                                Player[playerid][C4] = 0;
                                DeletePlayer3DTextLabel(playerid, PlayerText3D:0);
                                }
                }
        }
        else return 0;
        return 1;
}
The errors

pawn Код:
warning 217: loose indentation
warning 215: expression has no effect
error 001: expected token: ";", but found "["
error 029: invalid expression, assumed zero
warning 215: expression has no effect
error 001: expected token: ";", but found "]"
fatal error 107: too many error messages on one line
Please help

Thanks


Re: Why am i getting errors - Dan. - 16.07.2012

On which line is the error:

pawn Код:
error 001: expected token: ";", but found "["



Re: Why am i getting errors - Euan Hughes - 16.07.2012

Quote:
Originally Posted by Dan.
Посмотреть сообщение
On which line is the error:

pawn Код:
error 001: expected token: ";", but found "["
They are all on the same line

It has ERROR > before it

Please help

Thanks


Re: Why am i getting errors - shayan122 - 16.07.2012

hmm maybe you should add }
after
else return 0;


Re: Why am i getting errors - nuriel8833 - 16.07.2012

pawn Код:
warning 217: loose indentation
Add this on top of your script:
pawn Код:
#pragma tabsize 0
And which lines is this warning?:
pawn Код:
warning 215: expression has no effect



Re: Why am i getting errors - Dan. - 16.07.2012

This error:
pawn Код:
error 001: expected token: ";", but found "["
Is usually a sign, that you have missed a:
pawn Код:
;
But I didn't find any semicolons before the error line.


Re: Why am i getting errors - Euan Hughes - 16.07.2012

Quote:
Originally Posted by nuriel8833
Посмотреть сообщение
pawn Код:
warning 217: loose indentation
Add this on top of your script:
pawn Код:
#pragma tabsize 0
And which lines is this warning?:
pawn Код:
warning 215: expression has no effect
All the warnings are on the same line

pawn Код:
command(c4, playerid, params[]) {
        new
                Float:BombPosx,
                Float:BombPosy,
                Float:BombPosz;
        if(Player[playerid][Group] == 2)
        {
            if(Player[playerid][C4] == 0)
            {
                                GetPlayerPos(playerid, BombPosx, BombPosy, BombPosz);
                                Player[playerid][C4] = 1;
                ApplyAnimationEx(playerid, "BOMBER", "BOM_Plant", 3.1, 0, 1, 1, 1, 1);
                TogglePlayerControllable(playerid, true);
                SendClientMessage(playerid, WHITE, "You have planted a C4.");
               ERROR > Player[playerid][BombPos][0] = BombPosx;
                Player[playerid][BombPos][1] = BombPosy;
                Player[playerid][BombPos][2] = BombPosz;
                CreatePlayer3DTextLabel(playerid, "Bomb Planted", RED, Player[playerid][BombPos][0],Player[playerid][BombPos][1], Player[playerid][BombPos][2], 1000, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1);
            }
                else if(Player[playerid][C4] == 1)
                {
                        if(IsPlayerInRangeOfPoint(playerid, 5, Player[playerid][BombPos][0], Player[playerid][BombPos][1], Player[playerid][BombPos][2]))
                        {
                                ApplyAnimationEx(playerid, "BOMBER", "BOM_Plant", 3.1, 0, 1, 1, 1, 1);
                        TogglePlayerControllable(playerid, true);
                        SendClientMessage(playerid, WHITE, "You have picked your C4 up.");
                                Player[playerid][C4] = 0;
                                DeletePlayer3DTextLabel(playerid, PlayerText3D:0);
                                }
                }
        }
        else return 0;
        return 1;
}
pawn Код:
ERROR > Player[playerid][BombPos][0] = BombPosx;
Please help

Thanks


Re: Why am i getting errors - Dan. - 16.07.2012

Try removing the line:
pawn Код:
ApplyAnimationEx(playerid, "BOMBER", "BOM_Plant", 3.1, 0, 1, 1, 1, 1);
Still errors?


Re: Why am i getting errors - leonardo1434 - 16.07.2012

As he said above... which lines?


Re: Why am i getting errors - Euan Hughes - 16.07.2012

Quote:
Originally Posted by Dan.
Посмотреть сообщение
Try removing the line:
pawn Код:
ApplyAnimationEx(playerid, "BOMBER", "BOM_Plant", 3.1, 0, 1, 1, 1, 1);
Still errors?
Yes

Please help

Thanks