[Ajuda] help me
#1

Galera alguem pode me ajudar estou tentando fazer um tag para os players administradores
Tipo [ADM]Nick
[DONO]Nick
[SubDono]Nick

alguem pode me ajudar?

pawn Код:
if(PlayerInfo[playerid][Level] > 1)
{
 new String[500];
 format(String, sizeof(String), "{FF0000}[ADM] {FFFFFF}%s: {00FFFF}%s", Nome(playerid), text);
 SendClientMessageToAll(GetPlayerColor(playerid), String);
 return 1;
}

    if(PlayerInfo[playerid][Level] > 8)
{
 new String[500];
 format(String, sizeof(String), "{FFFF00}[DONO] {FFFFFF}%s: {00FFFF}%s", Nome(playerid), text);
 SendClientMessageToAll(GetPlayerColor(playerid), String);
 return 1;
}

if(PlayerInfo[playerid][Level] > 7)
{
 new String[500];
 format(String, sizeof(String), "{FF0000}[Sub Dono] {FFFFFF}%s: {FF0000}%s", Nome(playerid), text);
 SendClientMessageToAll(GetPlayerColor(playerid), String);
 return 1;
}
Estou fazendo no OnPlayerText nгo sei muito bem como й da pra me ajuda?
Reply
#2

Tenta ae!

PHP код:
if(PlayerInfo[playerid][Level] >= 1)
{
    new 
String[200];
    
format(Stringsizeof(String), "{FF0000}[ADM] {FFFFFF}%s: {00FFFF}%s"Nome(playerid), text);
    
SendClientMessageToAll(GetPlayerColor(playerid), String);
    return 
1;
}
if(
PlayerInfo[playerid][Level] == 8)
{
    new 
String[200];
    
format(Stringsizeof(String), "{FFFF00}[DONO] {FFFFFF}%s: {00FFFF}%s"Nome(playerid), text);
    
SendClientMessageToAll(GetPlayerColor(playerid), String);
    return 
1;
}
if(
PlayerInfo[playerid][Level] == 7)
{
    new 
String[200];
    
format(Stringsizeof(String), "{FF0000}[Sub Dono] {FFFFFF}%s: {FF0000}%s"Nome(playerid), text);
    
SendClientMessageToAll(GetPlayerColor(playerid), String);
    return 
1;

Reply
#3

Nгo deu digitei a msg e apareceu [ADM] Meu Nick msg
e meu nick normal msg 2 vezes
Reply
#4

O retorno da funзгo, deve ser 0, caso contrбrio haverб bugs.
Outro erro que tambйm notei, й que tudo nгo passarб da primeira condicional. Por exemplo, vocк "pergunta" se o level do player й maior do que 1 e abaixo vocк faz outra condicional verificando se o level do player й maior do que 8. Mas... Parando pra pensar, 8 tambйm nгo й > que 1? Por esse motivo seu cуdigo nunca chegarб as demais condicionais.

Outra coisa legal, seria a utilizaзгo de switch ao invйs de ifs. Sem falar, que vocк desperdiзa muitas cйlulas em seu sistema... O mбximo que poderб ser exibido no chat й 128 caracteres, entгo criar um vetor com 500 posiзхes nгo й legal.
Nгo testei o cуdigo, mas tente dessa forma:
PHP код:
new String[128];
switch(
PlayerInfo[playerid][Level])
{
    case 
1..7:
     {
         
format(Stringsizeof(String), "[ADM] {FFFFFF}%s: {00FFFF}%s"Nome(playerid), text);
           
SendClientMessageToAll(0xFF0000FFString);
           return 
0;
     }
    case 
8:
     {
         
format(Stringsizeof(String), "[Sub Dono] {FFFFFF}%s: {00FFFF}%s"Nome(playerid), text);
         
SendClientMessageToAll(0xFF0000FFString);
         return 
0;
    }
    case 
9:
    {
         
format(Stringsizeof(String), "[DONO] {FFFFFF}%s: {00FFFF}%s"Nome(playerid), text);
         
SendClientMessageToAll(0xFF0000FFString);
         return 
0;
    }

Reply
#5

@Edit: Eu nгo vi que jб tinha respondido, tava editando! ^^
Reply
#6

Quote:
Originally Posted by Artista
Посмотреть сообщение
O mбximo que poderб ser exibido no chat й 128 caracteres, entгo criar um vetor com 500 posiзхes
Sу corrigindo, o tamanho maximo de caracteres no chat й de 144!

Wiki
Reply
#7

Quote:
Originally Posted by IgorLuiz
Посмотреть сообщение
Sу corrigindo, o tamanho maximo de caracteres no chat й de 144!

Wiki
Caramba, sabe que eu nunca parei pra ver isso na wiki? '-' Tai, isso eu nгo sabia... Vou dar edit heheh valeu

@Edit
Bem, dei uma leve olhada nesse artigo da wiki samp, e pelo que entendi o tamanho mбximo no Chat Bubble й 144 caracteres, enquanto no chat й 128. Mas tambйm fiquei na dъvida pelo link que vocк me enviou...

@Edit
Fiz um teste e mensagens acima de 128 caracteres ficam cortadas. Entгo cheguei a conclusгo que o tamanho mбximo de caracteres a ser exibido no chat й de apenas 128 caracteres.
Reply
#8

Vlw Galera vcs sгo fodas rep pra todos
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)