error 029: invalid expression, assumed zero
#1

PHP код:
if(PRESSED(KEY_FIRE))
        {
        for(new 
iMAX_TREES++)
    {
        if(
IsPlayerInRangeOfPoint(playerid2.2tInfo[i][xPos], tInfo[i][yPos], tInfo[i][zPos]))
        {
            if(
GetPlayerWeapon(playerid) != 9) return SendClientMessage(playerid,COLOR_RED,"You need chainsaw to cut trees");
            if(
tInfo[i][Health] <= 0) return SendClientMessage(playeridCOLOR_GREY"This tree has already been cut down!");
            new 
Float:x,Float:y,Float:z;
             
GetPlayerPos(playerid,x,y,z);
             if(
GetPVarInt(playerid,"TreeCID") != i)
             {
             
SetPlayerProgressBarValue(playerid,cutting,0);
             }
             
SetPVarInt(playerid,"TreeCID",i);
             
KillTimer(CutT[playerid]);
            new 
Float:cb GetPlayerProgressBarValue(playerid,cutting);
            
ShowPlayerProgressBar(playerid,cutting);
            
SetPlayerProgressBarValue(playerid,cutting,cb+5);
            
UpdatePlayerProgressBar(playerid,cutting);
            
CutT[playerid] = SetTimerEx("CuTi",10000,0,"i",playerid);
            if(
cb == 100 || tInfo[i][Health] <= 0)
            {
            
ResetTree(i);
            
SetPVarInt(playerid,"TreeCID",-1);
            
SetPlayerProgressBarValue(playerid,cutting,0);
             
HidePlayerProgressBar(playerid,cutting);
            
CreateItem(ModelWood,1,x,y,z-1,0,0,0,0,0);
            }
            break;
        }
    } 
Error line:First line.I cant fix it
Reply
#2

pawn Код:
if(PRESSED(KEY_FIRE))
{
    for(new i; i < MAX_TREES; i ++)
    {
        if(IsPlayerInRangeOfPoint(playerid, 2.2, tInfo[i][xPos], tInfo[i][yPos], tInfo[i][zPos]))
        {
            if(GetPlayerWeapon(playerid) != 9) return SendClientMessage(playerid,COLOR_RED,"You need chainsaw to cut trees");
            if(tInfo[i][Health] <= 0) return SendClientMessage(playerid, COLOR_GREY, "This tree has already been cut down!");
            new Float:x,Float:y,Float:z;
            GetPlayerPos(playerid,x,y,z);
            if(GetPVarInt(playerid,"TreeCID") != i) SetPlayerProgressBarValue(playerid,cutting,0);
            SetPVarInt(playerid,"TreeCID",i);
            KillTimer(CutT[playerid]);

            new Float:cb = GetPlayerProgressBarValue(playerid,cutting);
            ShowPlayerProgressBar(playerid,cutting);
            SetPlayerProgressBarValue(playerid,cutting,cb+5);
            UpdatePlayerProgressBar(playerid,cutting);

            CutT[playerid] = SetTimerEx("CuTi",10000,0,"i",playerid);
            if(cb == 100 || tInfo[i][Health] <= 0)
            {
                ResetTree(i);
                SetPVarInt(playerid,"TreeCID",-1);
                SetPlayerProgressBarValue(playerid,cutting,0);
                HidePlayerProgressBar(playerid,cutting);
                CreateItem(ModelWood,1,x,y,z-1,0,0,0,0,0);

            }
            break;
        }
    }
}
there's a "}" missing!
Reply
#3

show us the definition of "PRESSED"
as on the wiki page, it should look like
pawn Код:
#define PRESSED(%0) \
(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
or
pawn Код:
#define PRESSED(%0) (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
cuz for example, if it's defined incorrectly, you'll get exactly that error.
by incorrectly i mean something like this, copy&paste from wiki but without the "\"
pawn Код:
#define PRESSED(%0)
    (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
but in this example, thou also get " error 010: invalid function or declaration"
pointing at the line under the definition of "PRESSED".

so you might've messed up something above your code too.

but "invalid expression, assumed zero" simply means that
the compiler could not interpret that expression so im sure that there's
something wrong with your definition of "PRESSED"
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)