SA-MP Forums Archive
[Ajuda] bug no id 0 - 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] bug no id 0 (/showthread.php?tid=405197)



bug no id 0 - Lukinhas_Ice - 05.01.2013

Код:
forward ContMaintxt();
public ContMaintxt()
{
	if(IniciandoRound || !RoundIniciado)
	return;
	
	if(modetipe == ARENA)
	{
	    sHealth[HOME] = 0;
	    sHealth[AWAY] = 0;
	    for(new i; i < MAX_PLAYERS; i++)
	    {
	        if(pTeam[i] == HOME && InRound[i] && !pSub[i])
	        {
	            static Float:HP, Float:Armour;
	            GetPlayerHealth(i, HP);
	            GetPlayerArmour(i, Armour);
	            sHealth[HOME] = sHealth[HOME] + HP + Armour;
	            SetPlayerScore(i, floatround(HP + Armour));
	        }
	        else if(pTeam[i] == AWAY && InRound[i] && !pSub[i])
	        {
	            static Float:HP, Float:Armour;
	            GetPlayerHealth(i, HP);
	            GetPlayerArmour(i, Armour);
	            sHealth[AWAY] = sHealth[AWAY] + HP + Armour;
	            SetPlayerScore(i, floatround(HP + Armour));
	        }
	    }
	
		new mensagem[190];
		format(mensagem, sizeof(mensagem), "~r~%s(~g~~h~%i~r~)                     ~w~--:--                    ~b~%s(~g~~h~%i~b~)", TeamName[HOME], floatround(sHealth[HOME]), TeamName[AWAY], floatround(sHealth[AWAY]));
		for(new i; i < MAX_PLAYERS; i++)
		{
			TextDrawHideForPlayer(i, maintxt[1]);
			TextDrawSetString(maintxt[1], mensagem);
			TextDrawShowForPlayer(i, maintxt[1]);
		}
	}
	SetTimer("ContMaintxt", 500, false);
}
o ID 0 fica com hp bugado ( 999999 ) e os outros ids fica normal
se alguem puder dar uma forзa =S


Re: bug no id 0 - Q.I - 05.01.2013

tente ;

pawn Код:
forward ContMaintxt();
public ContMaintxt(){
    for(new i = 0; i < MAX_PLAYERS; i++){
        if(IniciandoRound || !RoundIniciado)
        return;
        if(modetipe == ARENA){
            sHealth[HOME] = 0;
            sHealth[AWAY] = 0;
            if(pTeam[i] == HOME && InRound[i] && !pSub[i]){
                    static Float:HP, Float:Armour;
                    GetPlayerHealth(i, HP);
                    GetPlayerArmour(i, Armour);
                    sHealth[HOME] = sHealth[HOME] + HP + Armour;
                    SetPlayerScore(i, floatround(HP + Armour));
            }
            else if(pTeam[i] == AWAY && InRound[i] && !pSub[i]){
                    static Float:HP, Float:Armour;
                    GetPlayerHealth(i, HP);
                    GetPlayerArmour(i, Armour);
                    sHealth[AWAY] = sHealth[AWAY] + HP + Armour;
                    SetPlayerScore(i, floatround(HP + Armour));
            }
        }
        new mensagem[190];
        format(mensagem, sizeof(mensagem), "~r~%s(~g~~h~%i~r~)                     ~w~--:--                    ~b~%s(~g~~h~%i~b~)", TeamName[HOME], floatround(sHealth[HOME]), TeamName[AWAY], floatround(sHealth[AWAY]));
        TextDrawHideForPlayer(i, maintxt[1]);
        TextDrawSetString(maintxt[1], mensagem);
        TextDrawShowForPlayer(i, maintxt[1]);
    }
    SetTimer("ContMaintxt", 500, false); //arrume isso aqui , nгo sei o que isso tб fazendo aqui..
}



Re: bug no id 0 - Lukinhas_Ice - 05.01.2013

1 time o hp tб certo, o outro bugado e.e