SA-MP Forums Archive
error 029: invalid expression, assumed zero and more errors, I can not seem to get them - 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 and more errors, I can not seem to get them (/showthread.php?tid=650058)



error 029: invalid expression, assumed zero and more errors, I can not seem to get them - NemesisBR - 19.02.2018

the errors are these:



Код HTML:
error 029: invalid expression, assumed zero
warning 215: expression has no effect
error 001: expected token: ";", but found ")"
error 029: invalid expression, assumed zero
fatal error 107: too many error messages on one line
The line you are talking about is the first one below, see the complete code:

PHP код:
  if(issuerid != INVALID_PLAYER_ID && weaponid == 34 && bodypart == 9 && Arena2[playerid] == 0 && Arena[playerid] == 0 && mortohs[playerid] == false)
   {
      
SetPlayerHealth(playerid, 0.0);
      new 
strm[100], killer[MAX_PLAYER_NAME], killed[MAX_PLAYER_NAME];
      
GetPlayerName(issuerid,killer,sizeof(killer));
      
GetPlayerName(playerid,killer,sizeof(killer));
      
format(strm,sizeof(strm),"{09FF00}HeadShot: {FF0000}%s {09FF00}gave one HeadShot in {FF0000}%s",killer,killed);
      
SendClientMessageToAll(-1,strm);
      
mortohs[playerid] = true;
  } 



Re: error 029: invalid expression, assumed zero and more errors, I can not seem to get them - AdamsLT - 19.02.2018

If I understand correctly, the line with the errors is the if(...) line? If not, which line is it?

If yes, are you sure the lines before it are correct? Check to see if you didn't forget any semicolons (these things ; ) at the end of them. Show us them if you don't see anything.

Also, your code has problems.
It should be

Код:
GetPlayerName(issuerid,killer,sizeof(killer));
GetPlayerName(playerid,killed,sizeof(killed));
Also, increase the strm string size to about 120 as players with long names won't fit in your string.


Re: error 029: invalid expression, assumed zero and more errors, I can not seem to get them - NemesisBR - 19.02.2018

yes, it's the first line.

the back line is:

PHP код:
if(NoEvent[playerid] == 1)if(EventActive == 1 && NoEvent[issuerid] == 1 && EventOHK == true && GetPlayerWeapon(issuerid) > 1) SetPlayerHealth(playerid,0.0);
    
DamageTick[playerid] = TickCounter;
    } 



Re: error 029: invalid expression, assumed zero and more errors, I can not seem to get them - Dayrion - 20.02.2018

Give us the full code, your indentation is horrible


Re: error 029: invalid expression, assumed zero and more errors, I can not seem to get them - NemesisBR - 20.02.2018

Unfortunately there is no way to pass the whole code, because there are some 20,000 already made, I think it would not be cool.

But I believe you can do from the part where you started making the lines that the error line connects:

PHP код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
    if(
issuerid != INVALID_PLAYER_ID)
    {
    new 
string[20];
    
format(string, sizeof(string), "~s~-~r~%.0f", amount);
    
GameTextForPlayer(playerid, string, 1000, 6);
    
GameTextForPlayer(issuerid , string, 1000, 5);
    
PlayerPlaySound(issuerid , 17802, 0.0, 0.0, 0.0);
//===============================
    //SNIPER SNP2 ONE SHOT
    
if(SNP2[playerid] == true && Arena[playerid] == 1 && GetPlayerWeapon(issuerid) == 34) SetPlayerHealth(playerid,0.0);
    
//Event no damage
    
if(NoEvent[playerid] == 1)if(EventActive == 1 && NoEvent[issuerid] == 1 && Eventnodamage == true) SetPlayerHealth(issuerid,0.0);
    
//EventOHK
    
if(NoEvent[playerid] == 1)if(EventActive == 1 && NoEvent[issuerid] == 1 && EventOHK == true && GetPlayerWeapon(issuerid) > 1) SetPlayerHealth(playerid,0.0)
    
DamageTick[playerid] = TickCounter;
    }
   if(
issuerid != INVALID_PLAYER_ID && weaponid == 34 && bodypart == 9 && Arena2[playerid] == 0 && Arena[playerid] == 0 && mortohs[playerid] == false)
   {
      
SetPlayerHealth(playerid, 0.0);
      new 
strm[100], killer[MAX_PLAYER_NAME], killed[MAX_PLAYER_NAME];
      
GetPlayerName(issuerid,killer,sizeof(killer));
      
GetPlayerName(playerid,killed,sizeof(killed));
      
format(strm,sizeof(strm),"{09FF00}HeadShot: {FF0000}%s {09FF00}gave one HeadShot in {FF0000}%s",killer,killed);
      
SendClientMessageToAll(-1,strm);
      
mortohs[playerid] = true;
  }
return 
1;
} 
If you find errors in English, please ignore, I'm not fluent in English


Re: error 029: invalid expression, assumed zero and more errors, I can not seem to get them - UFF - 20.02.2018

Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid) 
{ 
    if(issuerid != INVALID_PLAYER_ID) 
    { 
    new string[20]; 
    format(string, sizeof(string), "~s~-~r~%.0f", amount); 
    GameTextForPlayer(playerid, string, 1000, 6); 
    GameTextForPlayer(issuerid , string, 1000, 5); 
    PlayerPlaySound(issuerid , 17802, 0.0, 0.0, 0.0); 
//=============================== 

    //SNIPER SNP2 ONE SHOT 
    if(SNP2[playerid] == true && Arena[playerid] == 1 && GetPlayerWeapon(issuerid) == 34)SetPlayerHealth(playerid,0.0); 
 
    //Event no damage 
    if(NoEvent[playerid] == 1)if(EventActive == 1 && NoEvent[issuerid] == 1 && Eventnodamage == true)SetPlayerHealth(issuerid,0.0); 
   
    //EventOHK 
    if(NoEvent[playerid] == 1)if(EventActive == 1 && NoEvent[issuerid] == 1 && EventOHK == true && 
    GetPlayerWeapon(issuerid) > 1) SetPlayerHealth(playerid,0.0); 
    DamageTick[playerid] = TickCounter; 
 
    } 

   if(issuerid != INVALID_PLAYER_ID & & weaponid == 34 && bodypart == 9 && Arena2[playerid] == 0 && Arena[playerid] == 0 && mortohs[playerid] == false) 
   { 
      SetPlayerHealth(playerid, 0.0); 
      new strm[100], killer[MAX_PLAYER_NAME], killed[MAX_PLAYER_NAME]; 
      GetPlayerName(issuerid,killer,sizeof(killer)); 
      GetPlayerName(playerid,killed,sizeof(killed)); 
      format(strm,sizeof(strm),"{09FF00}HeadShot: {FF0000}%s {09FF00}gave one HeadShot in {FF0000}%s",killer,killed); 
      SendClientMessageToAll(-1,strm); 
      mortohs[playerid] = true; 
  } 

return 1; 
}
try this