SA-MP Forums Archive
[Ajuda] Level pegando no NPC. - 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] Level pegando no NPC. (/showthread.php?tid=631998)



Level pegando no NPC. - JhefTFJ - 08.04.2017

Bom esse pequeno sistema ele nгo esta pegando acima do nick dos jogadores, apenas nos NPC, jб tentei de algumas formas resolver este problemas mas nгo conseguir por acima do nick dos jogadores!

Inicio
PHP код:
new Text3D:LevelPlayer
OnPlayerSpawn
PHP код:
for(new i=0i<MAX_PLAYERS; ++i)
{
format(str,sizeof(str),"Level: %d",Player[playerid][pLevel]);
LevelPlayer Create3DTextLabel(strCOR_BRANCO30.040.050.040.00);
Attach3DTextLabelToPlayer(LevelPlayer,i,0.00.00.7);
SetTimer("update",1000,1);

Final
PHP код:
forward update();
public 
update()
{
new 
str[256], playerid;
format(str,sizeof(str),"Level: %d",Player[playerid][pLevel]);
Update3DTextLabelText(LevelPlayerCOR_BRANCO,str);




Re: Level pegando no NPC. - HoodScript - 08.04.2017

PHP код:
for(new i=0i<MAX_PLAYERS; ++i)
{
format(str,sizeof(str),"Level: %d",Player[playerid][pLevel]);
LevelPlayer CreatePlayer3DTextLabel(istrCOR_BRANCO30.040.050.040.00);
Attach3DTextLabelToPlayer(LevelPlayer,i,0.00.00.7);
UpdatePlayer3DTextLabelText(iLevelPlayerCOR_BRANCO,str);




Re: Level pegando no NPC. - [BOPE]Seu._.Madruga - 08.04.2017

PHP код:
for(new 0i<MAX_PLAYERS; ++i)
{
    if(!
IsPlayerNPC(i)) {
        
format(str,sizeof(str),"Level: %d",Player[playerid][pLevel]);
        
LevelPlayer Create3DTextLabel(strCOR_BRANCO30.040.050.040.00);
        
Attach3DTextLabelToPlayer(LevelPlayer,i,0.00.00.7);
        
SetTimer("update",1000,1);
    }




Re: Level pegando no NPC. - [BOPE]Seu._.Madruga - 08.04.2017

PHP код:


new Text3D:LevelPlayer[MAX_PLAYERS];


public 
OnGameModeInit()
{
    
SetTimer("UpdateLabel"20000true);
    return 
1;
}

public 
OnPlayerSpawn(playerid)
{
    new 
str[256];
    if(!
IsPlayerNPC(playerid)) {
        
format(str,sizeof(str),"Level: %d"Player[playerid][pLevel]);
        
LevelPlayer[playerid] = Create3DTextLabel(str, -130.040.050.040.00);
        
Attach3DTextLabelToPlayer(LevelPlayer[playerid], playerid ,0.00.00.7);
    }
    return 
1;
}

public 
OnPlayerDisconnect(playeridreason)
{
    
Delete3DTextLabel(LevelPlayer[playerid]);
    return 
1;
}

stock UpdateLabel() {
    new 
str[256];
    for(new 
0MAX_PLAYERS; ++i) {
        if(!
IsPlayerNPC(i)) {
            
format(str,sizeof(str),"Level: %d",Player[i][pLevel]);
            
Update3DTextLabelText(LevelPlayer[i], COR_BRANCO,str);
        }
    }




Re: Level pegando no NPC. - JhefTFJ - 08.04.2017

Quote:
Originally Posted by [BOPE]Seu._.Madruga
Посмотреть сообщение
PHP код:

new Text3D:LevelPlayer[MAX_PLAYERS];
public 
OnGameModeInit()
{
    
SetTimer("UpdateLabel"20000true);
    return 
1;
}
public 
OnPlayerSpawn(playerid)
{
    new 
str[256];
    if(!
IsPlayerNPC(playerid)) {
        
format(str,sizeof(str),"Level: %d"Player[playerid][pLevel]);
        
LevelPlayer[playerid] = Create3DTextLabel(str, -130.040.050.040.00);
        
Attach3DTextLabelToPlayer(LevelPlayer[playerid], playerid ,0.00.00.7);
    }
    return 
1;
}
public 
OnPlayerDisconnect(playeridreason)
{
    
Delete3DTextLabel(LevelPlayer[playerid]);
    return 
1;
}
stock UpdateLabel() {
    new 
str[256];
    for(new 
0MAX_PLAYERS; ++i) {
        if(!
IsPlayerNPC(i)) {
            
format(str,sizeof(str),"Level: %d",Player[i][pLevel]);
            
Update3DTextLabelText(LevelPlayer[i], COR_BRANCO,str);
        }
    }

funfou quase perfeitamente, apenas o level do player que nгo estб atualizando, apenas quando ele reloga ae aparece lv 15, e como se estivesse duas Create3DTextLabel uma por cima da outra.