[Help] Error 076 Syntax error.
#1

Код:
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
Reply
#2

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

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;
}
Reply
#4

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 -_-
Reply
#5

Btw which line is giving error?
Reply
#6

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);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)