SA-MP Forums Archive
[Ajuda] Hud Arma - 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] Hud Arma (/showthread.php?tid=634559)



Hud Arma - Scorpion659 - 21.05.2017

Olб, criei uma hud simples de arma, mas quando to no server aparece na TD: soco, e 0

mesmo eu mudando de arma ele continua no soco, olhe o codigo: (essa funзгo й atualizada a cada meio segundo)

PHP код:
new arma[MAX_PLAYERS], mun[MAX_PLAYERS], slotn;
new 
sarma[MAX_PLAYERS][32], smun[MAX_PLAYERS][32];
stock armasatt()
{
    foreach(new 
i : Player){
        
GetPlayerWeaponData(i, slotn, arma[i], mun[i]);
        if(
arma[i] == 31){
            
format(sarma[i], 32, "M4A1");
        }else if(
arma[i] == 30){
            
format(sarma[i], 32, "AK-47");
        }else if(
arma[i] == 25){
            
format(sarma[i], 32, "Shotgun");
        }else if(
arma[i] == 27){
            
format(sarma[i], 32, "Spaz");
        }else if(
arma[i] == 33){
            
format(sarma[i], 32, "Rifle");
        }else if(
arma[i] == 34){
            
format(sarma[i], 32, "Sniper");
        }else if(
arma[i] == 24){
            
format(sarma[i], 32, "Desert");
        }else if(
arma[i] == 29){
            
format(sarma[i], 32, "MP5");
        }else if(
arma[i] == 4){
            
format(sarma[i], 32, "Faca");
        }else if(
arma[i] == 5){
            
format(sarma[i], 32, "Taco");
        }else if(
arma[i] == 8){
            
format(sarma[i], 32, "Espada");
        }else if(
arma[i] == 23){
            
format(sarma[i], 32, "Silenced");
        }else if(
arma[i] == 16){
            
format(sarma[i], 32, "Granada");
        }else if(
arma[i] == 17){
            
format(sarma[i], 32, "Tear Gas");
        }else if(
arma[i] == 46){
            
format(sarma[i], 32, "Paraquedas");
        }else if(
arma[i] == 43){
            
format(sarma[i], 32, "Binoculo");
        }else if(
arma[i] == 0){
            
format(sarma[i], 32, "Soco");
        }else if(
arma[i] == -1){
            
printf("f");
        }else{
            
BanEx(i, "Weapon Hacker");
        }
        
format(smun[i], 32, "%d", mun[i]);
        
PlayerTextDrawSetString(i, Textdraw62, sarma[i]);
        
PlayerTextDrawSetString(i, Textdraw63, smun[i]);
    }
    return 
1;
} 
alguem pode me ajudar?


Re: Hud Arma - Showzs - 21.05.2017

Sempre que alteramos uma informaзгo na textdraw temos que a mostrar novamente..

PlayerTextDrawShow(i, Textdraw62);
PlayerTextDrawShow(i, Textdraw63);


Re: Hud Arma - Scorpion659 - 21.05.2017

n deu


Re: Hud Arma - ViniBorn - 21.05.2017

Tб chamando armasatt por um timer?


Re: Hud Arma - Scorpion659 - 21.05.2017

Quote:
Originally Posted by ViniBorn
Посмотреть сообщение
Tб chamando armasatt por um timer?
sim, de meio em meio segundo


Re: Hud Arma - ViniBorn - 21.05.2017

Usa public no lugar de stock


Re: Hud Arma - Scorpion659 - 21.05.2017

Quote:
Originally Posted by ViniBorn
Посмотреть сообщение
Usa public no lugar de stock
sim, mas essa stock nгo estб diretamente ao timer, o timer aciona uma public que aciona todas as stocks que precisam ser atualizadas, ex:


PHP код:
public attrapida()
{
    
infocarro();
    
updadeitens();
    
pdebug();
    
armasatt();
    return 
1;
} 



Re: Hud Arma - Scorpion659 - 21.05.2017

Desculpe o double post mas acho que sei o problema, o slot n ta definido entгo nгo mostra arma nenhuma, entгo como faзo pra obter a arma que o jogador ta segurando e a muniзгo?

@edit

vlw consegui

https://sampforum.blast.hk/showthread.php?tid=476093

@edit 2:

puxa muito se eu por o timer pra 200ms? preciso que atualize rapido a arma e tals pois fica estranho ficar travando