Help, i have a error
#1

I need this command does not add more life

public OnPlayerPickUpPickup(playerid, pickupid)
{
if(pickupid == City)
{
GameTextForPlayer(playerid, " Estas En Tierra Robada ", 6000,1);
GivePlayerWeapon(playerid, 46, 1);
SetPlayerHealth(playerid, 94);
SetPlayerPos(playerid,-1492.5255,2509.5999,601.1897);
SetPlayerVirtualWorld(playerid, -1);
SetTimerEx("FuncionVida",1000,true,"i",playerid);
}
return 1;
}


forward FuncionVida();
public FuncionVida()
{
for(new i;i<MAX_PLAYERS;i++)
{
new funcionvidaa[i] = SetTimerEx("FuncionVida",1000,true,"i",playerid);
if(IsPlayerConnected(i)) // Verifica que el jugador estй conectado y logeado
{
GetPlayerHealth(i, health); //Estableciendo el valor flotante health con GetPlayerHealth
if(health > 0) //Si su vida es mayor a 0...
SetPlayerHealth(i, health+5); //Da +5 de vida al jugado
else
if(health > 95)
KillTimer(funcionvidaa[i])
}

}
return 1;
}

The error in this line

new funcionvidaa[i] = SetTimerEx("FuncionVida",1000,true,"i",playerid);

HELP !!!!
Reply
#2

Can you show us the error?
Reply
#3

1 you forgot to declare health
2 you'r brackets were bad

PHP код:
if
}

fix:

PHP код:
public OnPlayerPickUpPickup(playeridpickupid)
{
    if(
pickupid == City)
    {
        
GameTextForPlayer(playerid" Estas En Tierra Robada "6000,1);
        
GivePlayerWeapon(playerid461);
        
SetPlayerHealth(playerid94);
        
SetPlayerPos(playerid,-1492.5255,2509.5999,601.1897);
        
SetPlayerVirtualWorld(playerid, -1);
        
SetTimerEx("FuncionVida",1000,true,"i",playerid);
    }
    return 
1;
}
forward FuncionVida();
public 
FuncionVida()
{
    new 
Float:health;
    for(new 
i;i<MAX_PLAYERS;i++)
    {
        new 
funcionvidaa[i] = SetTimerEx("FuncionVida",1000,true,"i",playerid);
        if(
IsPlayerConnected(i)) // Verifica que el jugador estй conectado y logeado
    
{
    
GetPlayerHealth(ihealth); //Estableciendo el valor flotante health con GetPlayerHealth
    
if(health && < 95)
    { 
//Si su vida es mayor a 0...
        
SetPlayerHealth(ihealth+5); //Da +5 de vida al jugado
    
}
    if(
health 95)
    {
        
KillTimer(funcionvidaa[i])
    }
    return 
1;

Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)