SA-MP Forums Archive
[Help] Error 076 Syntax error. - 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: [Help] Error 076 Syntax error. (/showthread.php?tid=328390)



[Help] Error 076 Syntax error. - viddo - 24.03.2012

Код:
forward CheckHealth(playerid);
public CheckHealth(playerid)
{
   new Float:Health;
    GetPlayerHealth(playerid,Health);
    if(Health < 20)
    {
   		losehp = SetTimer("losehp",1500000,true);
    }
    return 1;
}

forward losehp(playerid);
public losehp(playerid)
{
   new Float:Health;
   GetPlayerHealth(playerid, Health);
   SetPlayerHealth(playerid, Health-5);
   return 1;
}
Код:
error 076: syntax error in the expression, or invalid function call



Re: [Help] Error 076 Syntax error. - XePloiT - 24.03.2012

i think its might be because you have two different things named "losehp"...
change one of them... or the function or the timer


Re: [Help] Error 076 Syntax error. - Kiets - 24.03.2012

Quote:
Originally Posted by viddo
Посмотреть сообщение
Код:
forward CheckHealth(playerid);
public CheckHealth(playerid)
{
   new Float:Health;
    GetPlayerHealth(playerid,Health);
    if(Health < 20)
    {
   		losehp = SetTimer("losehp",1500000,true);
    }
    return 1;
}

forward losehp(playerid);
public losehp(playerid)
{
   new Float:Health;
   GetPlayerHealth(playerid, Health);
   SetPlayerHealth(playerid, Health-5);
   return 1;
}
Код:
error 076: syntax error in the expression, or invalid function call
I think the problem is that you didn't add playerid parameter in settimer, so it should be
Код:
forward CheckHealth(playerid);
public CheckHealth(playerid)
{
   new Float:Health;
    GetPlayerHealth(playerid,Health);
    if(Health < 20)
    {
   		losehp = SetTimerEx("losehp",1500000,true,"i",playerid);
    }
    return 1;
}

forward losehp(playerid);
public losehp(playerid)
{
   new Float:Health;
   GetPlayerHealth(playerid, Health);
   SetPlayerHealth(playerid, Health-5);
   return 1;
}



Re: [Help] Error 076 Syntax error. - viddo - 24.03.2012

Quote:
Originally Posted by Kiets
Посмотреть сообщение
I think the problem is that you didn't add playerid parameter in settimer, so it should be
Код:
forward CheckHealth(playerid);
public CheckHealth(playerid)
{
   new Float:Health;
    GetPlayerHealth(playerid,Health);
    if(Health < 20)
    {
   		losehp = SetTimerEx("losehp",1500000,true,"i",playerid);
    }
    return 1;
}

forward losehp(playerid);
public losehp(playerid)
{
   new Float:Health;
   GetPlayerHealth(playerid, Health);
   SetPlayerHealth(playerid, Health-5);
   return 1;
}
Still -_-


Re: [Help] Error 076 Syntax error. - Kiets - 24.03.2012

Btw which line is giving error?


Re: [Help] Error 076 Syntax error. - Kiets - 24.03.2012

ah i know the mistake, this line:
losehp = SetTimer("losehp",1500000,true);
define the first variable with some other name, for example:
Код:
//on top of the script
new losehptimer;
//your new line
losehptimer = SetTimer("losehp",1500000,true,"i",playerid);