Why am i getting errors
#1

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

On which line is the error:

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

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

hmm maybe you should add }
after
else return 0;
Reply
#5

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

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

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

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

As he said above... which lines?
Reply
#10

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
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)