Some errors
#1

I get those errors:
Код:
p.pwn(19989) : error 017: undefined symbol "Health"
C:\Users\Viddo\Desktop\LARP 4.0\LARP 4.0 D\gamemodes\larp.pwn(19991) : error 076: syntax error in the expression, or invalid function call
C:\Users\Viddo\Desktop\LARP 4.0\LARP 4.0 D\gamemodes\larp.pwn(19995) : warning 235: public function lacks forward declaration (symbol "hptimer")
C:\Users\Viddo\Desktop\LARP 4.0\LARP 4.0 D\gamemodes\larp.pwn(19997) : error 017: undefined symbol "Health"
C:\Users\Viddo\Desktop\LARP 4.0\LARP 4.0 D\gamemodes\larp.pwn(19999) : error 010: invalid function or declaration
When i add this:
Код:
public CheckHealth(playerid)
{
    new Float:health;
    GetPlayerHealth(playerid,health);

	if(Health < 20)
	{
			hptimer = SetTimer("losehp",1000,true);
		}
	return 1;
}
public hptimer(playerid)
{
   SetPlayerHealth(playerid, Health -5); //player loses 5hp each time the timer is called.
}
return 1;
}
Need fix plz, Thx
Reply
#2

pawn Код:
new Float:Health;
public CheckHealth(playerid)
{
    GetPlayerHealth(playerid,Health);

    if(Health < 20)
    {
            hptimer = SetTimer("losehp",1000,true);
        }
    return 1;
}
public losehp(playerid)
{
   SetPlayerHealth(playerid, Health -5); //player loses 5hp each time the timer is called.
}
return 1;
}
try that or
pawn Код:
public CheckHealth(playerid)
{
    GetPlayerHealth(playerid,Health);

    if(Health < 20)
    {
            SetTimerEx("losehp",1000,false,"i",playerid);
        }
    return 1;
}
public losehp(playerid)
{
   SetPlayerHealth(playerid, Health -5); //player loses 5hp each time the timer is called.
}
Reply
#3

pawn Код:
new hptimer; //at the top of script

new Float:Health;

public CheckHealth(playerid)
{
    GetPlayerHealth(playerid,Health);
    if(Health < 20)
    {
        hptimer = SetTimer("losehp",1000,true);
    }
    return 1;
}

forward hptimer(playerid);
public hptimer(playerid)
{
   GetPlayerHealth(playerid, Health);
   SetPlayerHealth(playerid, Health -5);
   return 1;
}
Reply
#4

PHP код:
new Float:health;
new 
hptimer[MAX_PLAYERS];
public 
CheckHealth(playerid){
    
GetPlayerHealth(playerid,health);
    if(
Health 20){
         
hptimer[playerid] = SetTimer("losehp",1000,true);
    }
    return 
1;
}
public 
losehp(playerid){
       
SetPlayerHealth(playeridhealth-5);
    return 
1;

Reply
#5

you shouldn't use SetTimer because its at general, better use SetTimerEx, that function work for exactly player
Reply
#6

Код:
C:\Users\Viddo\Desktop\LARP 4.0\LARP 4.0 D\gamemodes\larp.pwn(78185) : warning 219: local variable "Health" shadows a variable at a preceding level
C:\Users\Viddo\Desktop\LARP 4.0\LARP 4.0 D\gamemodes\larp.pwn(79014) : warning 219: local variable "Health" shadows a variable at a preceding level
C:\Users\Viddo\Desktop\LARP 4.0\LARP 4.0 D\gamemodes\larp.pwn(79045) : warning 219: local variable "Health" shadows a variable at a preceding level
C:\Users\Viddo\Desktop\LARP 4.0\LARP 4.0 D\gamemodes\larp.pwn(80720) : warning 219: local variable "Health" shadows a variable at a preceding level
C:\Users\Viddo\Desktop\LARP 4.0\LARP 4.0 D\gamemodes\larp.pwn(80734) : warning 219: local variable "Health" shadows a variable at a preceding level
C:\Users\Viddo\Desktop\LARP 4.0\LARP 4.0 D\gamemodes\larp.pwn(80748) : warning 219: local variable "Health" shadows a variable at a preceding level
C:\Users\Viddo\Desktop\LARP 4.0\LARP 4.0 D\gamemodes\larp.pwn(80762) : warning 219: local variable "Health" shadows a variable at a preceding level
C:\Users\Viddo\Desktop\LARP 4.0\LARP 4.0 D\gamemodes\larp.pwn(81566) : warning 219: local variable "Health" shadows a variable at a preceding level
LOL !
Reply
#7

Somewhere you have already defined the Health, find the local variable(new Float:Health) and remove it.
Reply
#8

Yea but when i remove (new Float:Health It give me that Health is undefined in those things..
Reply
#9

Don't remove the global variable(that one from the top of your gamemode).
Reply
#10

Quote:
Originally Posted by viddo
Посмотреть сообщение
Yea but when i remove (new Float:Health It give me that Health is undefined in those things..
double check, using the find tool in pawno is very very helpful for this cases.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)