PDA

View Full Version : Why am i getting errors


Euan Hughes
16/07/2012, 06:02 PM
So i tried to do a /c4 command but i kept getting errors and i dont understand why


BombPos;



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


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

Dan.
16/07/2012, 06:14 PM
On which line is the error:

error 001: expected token: ";", but found "["

Euan Hughes
16/07/2012, 06:19 PM
On which line is the error:

error 001: expected token: ";", but found "["

They are all on the same line

It has ERROR > before it

Please help

Thanks

shayan122
16/07/2012, 06:27 PM
hmm maybe you should add }
after
else return 0;

nuriel8833
16/07/2012, 06:28 PM
warning 217: loose indentation


Add this on top of your script:

#pragma tabsize 0


And which lines is this warning?:

warning 215: expression has no effect

Dan.
16/07/2012, 06:32 PM
This error:
error 001: expected token: ";", but found "["

Is usually a sign, that you have missed a: ; But I didn't find any semicolons before the error line.

Euan Hughes
16/07/2012, 06:32 PM
warning 217: loose indentation


Add this on top of your script:

#pragma tabsize 0


And which lines is this warning?:

warning 215: expression has no effect



All the warnings are on the same line


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;
}




ERROR > Player[playerid][BombPos][0] = BombPosx;

Please help

Thanks

Dan.
16/07/2012, 06:34 PM
Try removing the line:
ApplyAnimationEx(playerid, "BOMBER", "BOM_Plant", 3.1, 0, 1, 1, 1, 1);

Still errors?

leonardo1434
16/07/2012, 06:36 PM
As he said above... which lines?

Dan.
16/07/2012, 06:37 PM
He said, that all the warnings are on the same line.

Euan Hughes
16/07/2012, 06:37 PM
Try removing the line:
ApplyAnimationEx(playerid, "BOMBER", "BOM_Plant", 3.1, 0, 1, 1, 1, 1);

Still errors?

Yes

Please help

Thanks