SA-MP Forums Archive
[Ajuda] LabelToPlayer + ChatBubble - 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] LabelToPlayer + ChatBubble (/showthread.php?tid=604061)



LabelToPlayer + ChatBubble - Stroon - 31.03.2016

Pessoal como faзo para colocar uma Label de ''Administrador'' usando ao mesmo tempo o ChatDubble(mensagem que o player escreveu no chat aparecendo em cima da cabeзa dele).
-
Queria colocar 'Administrador' e em cima do administrador a mensagem que ele escrever/escreveu.(No caso ficaria duas Label sem bugar).
Uso sistema por rcon
Quote:

if(!(IsPlayerAdmin(playerid)))




Re: LabelToPlayer + ChatBubble - Whoo - 31.03.2016

Utilize Attach3DTextLabelToPlayer assim vocк deixa mais alto que o ChatDubble aн nгo causa bug de ficar um texto em cima do outro.


Re: LabelToPlayer + ChatBubble - Stroon - 31.03.2016

Coloquei:
PHP код:
SetTimer("TextPlayer",1000true); //Em: OnFilterScriptInit
forward TextPlayer(); // Avulso
public TextPlayer() // FIM do FS
{
    for (new 
0MAX_PLAYERSi++) {
        if (
PlayerInfo[i][Level] >= 1) {
            new 
Text3Dlabel Create3DTextLabel("* Administrador *"0x86DD63FF30.040.050.040.00);
            
Attach3DTextLabelToPlayer(labeli0.00.00.7);
        }
    }

Funcionou, porйm quando o ADM й nгo й mais adm a tag continua em cima da cabeзa do player.
-
Tambйm queria de um jeito que ao player logar e ele for administrador a tag jб esteja nele, e caso ele seja removido de administrador a tag serб removida. E tambйm uma possibilidade de ser Ativada/Desativada pelo ADM em questгo. Ex se ele quiser: /TagON -> Ativa a tag | /TagOFF -> Desativa.
-
Se alguйm puder ajudar, agradeзo.


Re: LabelToPlayer + ChatBubble - F1N4L - 31.03.2016

@EDITADO

Cуdigo reformulado:

Para somente os admins
PHP код:
//VAR GLOBAL
new bool:TagOnOff;
SetTimer("TextPlayer",1000true); //Em: OnFilterScriptInit 
CMD:tagconfig()
{
    for (new 
0MAX_PLAYERSi++) {  
        if(
TagOnOff[i] == false)
            
TagOnOff[i] = true;
        else 
TagOnOff[i] = false;
    }
    return 
1;
}
forward TextPlayer(); // Avulso  
public TextPlayer() // FIM do FS  
{  
    new 
Text3D:label;
    for (new 
0MAX_PLAYERSi++) {  
        if (
PlayerInfo[i][Level] > && TagOnOff[i] == true) {  
            
label Create3DTextLabel("* Administrador *"0x86DD63FF30.040.050.040.00);  
            
Attach3DTextLabelToPlayer(labeli0.00.00.7);  
        }  
        else if (
PlayerInfo[i][Level] < && TagOnOff[i] == false) {  
            
Delete3DTextLabel(label);
        } 
      else 
Delete3DTextLabel(label); 
    }  

EDITADO


Re: LabelToPlayer + ChatBubble - Stroon - 31.03.2016

PHP код:
(8780) : error 036: empty statement// if (PlayerInfo[i][Level] >= 1 && TagOnOff == true); {
(8781) : warning 219local variable "label" shadows a variable at a preceding level:  // new Text3D: label = Create3DTextLabel("* Administrador *", 0x86DD63FF, 30.0, 40.0, 50.0, 40.0, 0);
(8784) : error 029invalid expressionassumed zero//  else Delete3DTextLabel(label); 
@F1N4L Teria como passar o cmd em dcmd_ ?


Re: LabelToPlayer + ChatBubble - F1N4L - 31.03.2016

N utilizo dcmd, mas tenta...

PHP код:
dcmd_tagconfig(params[])
{
    
#pragma unused params
    
    
if(TagOnOff == false)
        
TagOnOff true;
    else 
TagOnOff false;
    
    return 
1;

@EDIT

corrigi o cуdigo, bobeira minha... copia lб.


Re: LabelToPlayer + ChatBubble - Stroon - 31.03.2016

@F1N4L, coloquei o zcmd no FS, pq essa dcmd й uma bosta, copie do edit lб, agr ta isso
PHP код:
(8789) : warning 219local variable "label" shadows a variable at a preceding level 
@edit


Re: LabelToPlayer + ChatBubble - F1N4L - 31.03.2016

Deu, eu defini sem perceber a var 2 vezes, tenta agr..

remova a var global, deixe apenas na callback...
new Text3D:label;


Re: LabelToPlayer + ChatBubble - Stroon - 31.03.2016

@F1N4L, funcionou porйm quando uso o comando para ativar ela estб ativando apenas no player ID 0, o outro ID 1 nгo ativa, e ao tirar o adm do que estб com a tag e usar o comando novamente que seria para remover, nгo remove. E quando loga jб setado como adm a tag nгo aparece, sу aparece depois que usa o cmd para ativar.


Re: LabelToPlayer + ChatBubble - F1N4L - 31.03.2016

Tenta agora...