SA-MP Forums Archive
[ajuda] oque hб de errado nesse public? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [ajuda] oque hб de errado nesse public? (/showthread.php?tid=256043)



[ajuda] oque hб de errado nesse public? - Sonic Hero - 18.05.2011

OQUE HБ DE ERRADO NISSO AKI?

Код:
public ChecarLife(playerid)
{
    for(new i = 0; i <MAX_PLAYERS; i++)
    {
        if(GetPlayerArmour(i) > 0)
        {
            SetPlayerAttachedObject( i, 5, 19142, 1, 0.100563, 0.056516, 0.003794, 0.000000, 0.000000, 0.000000, 1.000000, 1.000000, 1.000000 );
        }
        else
        {
            RemovePlayerAttachedObject(i,5);
        }
    }
}
ele ta dando warning 202 na linha do
Код:
if(GetPlayerArmour(i) > 0)



Re: [ajuda] oque hб de errado nesse public? - Carl_Thuse - 18.05.2011

Por que tu ensiste criar 2 Tуpicos no mesmo dia?? Cria tudo no mesmo Tуpico!!!
@TOPIC
Tu precisa de um float para Pegar a armadura:
pawn Код:
new Float:Armour;
GetPlayerArmour(i,Armour);
if(Armour > 0) //............



Re: [ajuda] oque hб de errado nesse public? - Sonic Hero - 18.05.2011

nгo mano,tipo eu queria um sistema pra quando o colete do cara tive 0 o objeto sumi do corpo ai os cara me feis assim у:

Код:
forward ChecarLife(playerid);
public ongamemodeinit:
Код:
SetTimer("ChecarLife",500,true);
e ai um public:

Код:
public ChecarLife(playerid)
{
    for(new i = 0; i <MAX_PLAYERS; i++)
    {
        if(GetPlayerArmour(i) > 0)
        {
            SetPlayerAttachedObject( i, 5, 19142, 1, 0.100563, 0.056516, 0.003794, 0.000000, 0.000000, 0.000000, 1.000000, 1.000000, 1.000000 );
        }
        else
        {
            RemovePlayerAttachedObject(i,5);
        }
    }
}
porque oque eu quero й que quando o cara tive 1+ de colete seta o objeto no corpo dele e quando tive 0 de colete o objeto se retirar automatico


Re: [ajuda] oque hб de errado nesse public? - Carl_Thuse - 18.05.2011

Toma mano, era sу corrigir...
pawn Код:
forward ChecarLife();
//OnGameModeInit..
SetTimer("ChecarLife",1000,true);
//Final do GM
public ChecarLife()
{
    for(new i = 0; i <MAX_PLAYERS; i++)
    {
        new Float:Armour;
        GetPlayerArmour(i,Armour);
        if(Armour > 0)
        {
            SetPlayerAttachedObject( i, 5, 19142, 1, 0.100563, 0.056516, 0.003794, 0.000000, 0.000000, 0.000000, 1.000000, 1.000000, 1.000000 );
        }
        else
        {
            RemovePlayerAttachedObject(i,5);
        }
    }
}
Nгo fique usando muitos forward Exemplo(Parametros); // Tente nгo usar parametros para timer, acho que nгo sгo uteis *-*
Se for alguem me conte xD


Re: [ajuda] oque hб de errado nesse public? - Sonic Hero - 18.05.2011

vou testar se funfa eu edit


Re: [ajuda] oque hб de errado nesse public? - Sonic Hero - 18.05.2011

ae mano deu fail,ele nem adiciona nem remove :S


Re: [ajuda] oque hб de errado nesse public? - Carl_Thuse - 18.05.2011

Antes da mudanзa ele adicionava e removia? Se nгo, o problema й com o SetPlayerAttachedObject.


Re: [ajuda] oque hб de errado nesse public? - Sonic Hero - 18.05.2011

am na verdade antes da mudanзa ele adicionava sim,nгo й porque vc deixou vago os "()"?? nгo devia ser playerid ou "i" ?


Re: [ajuda] oque hб de errado nesse public? - RockFire - 18.05.2011

pawn Код:
forward ChecarLife();

SetTimerEx("ChecarLife",1000,true);

public ChecarLife()
{
    new Float:Armour[MAX_PLAYERS];
    GetPlayerArmour(i,Armour[i]);
    for(new i = 0; i < GetMaxPlayers(); i++)
    {
        if(Armour[i] > 0)
        {
            SetPlayerAttachedObject(i,5, 19142,1,0.100563, 0.056516, 0.003794, 0.000000, 0.000000, 0.000000, 1.000000, 1.000000, 1.000000 );
        }
        else
        {
            if(IsPlayerAttachedObjectSlotUsed(playerid,5)) RemovePlayerAttachedObject(playerid,5);
        }
    }
}
Tenta assim, nгo sei se vai dar certo, mas tenta


Re: [ajuda] oque hб de errado nesse public? - Macintosh - 18.05.2011

pawn Код:
public ChecarLife(playerid)
{
    for(new i = 0; i <MAX_PLAYERS; i++)
    {
        if(GetPlayerArmour(i) > 0)
        {
            SetPlayerAttachedObject( i, 5, 19142, 1, 0.100563, 0.056516, 0.003794, 0.000000, 0.000000, 0.000000, 1.000000, 1.000000, 1.000000 );
              return 1;
        }
        else if(GetPlayerArmour(i) <= 0)
        {
            RemovePlayerAttachedObject(i,5);
            return 1;
        }
    }
 return 1;
}
Rwnrw.