SA-MP Forums Archive
error 029: invalid expression, assumed zero - 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: error 029: invalid expression, assumed zero (/showthread.php?tid=534388)



error 029: invalid expression, assumed zero - SandKing94 - 29.08.2014

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


Re: error 029: invalid expression, assumed zero - Sayros - 29.08.2014

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!


AW: error 029: invalid expression, assumed zero - CutX - 29.08.2014

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"