[ajuda] Comando /admins n funfa :(
#1

Galera, fiz o comando /admins aqui mas nгo ta funfando me ajuda ai :S
PHP код:
CMD:admins(playerid,params[])
{
    new 
string[128], sendername[MAX_PLAYER_NAME];
        
GetPlayerName(playeridsendernamesizeof(sendername));
    
SendClientMessage(playerid, -1"|__{00FF40}B{FFFFFF}|{FFFF00}M{FFFFFF}|{0000FF}W{FFFFFF}____| {F97C00}ADMINS ONLINE {FFFFFF}|____{00FF40}B{FFFFFF}|{FFFF00}M{FFFFFF}|{0000FF}W{FFFFFF}__|");
    if(
Trabalhando[playerid] == 0)
    {
        if(
PlayerInfo[playerid][pAdmin] == 1) return format(stringsizeof(string), "{00FF40}Admins: ({F97C00}%s{00FF40}) Nivel: ({F97C00}Moderador{00FF40}) Modo: ({F97C00}Jogando{00FF40})",sendername);SendClientMessage(playeridCinzastring);
        if(
PlayerInfo[playerid][pAdmin] == 2) return format(stringsizeof(string), "{00FF40}Admins: ({F97C00}%s{00FF40}) Nivel: ({F97C00}Administrador{00FF40}) Modo: ({F97C00}Jogando{00FF40})",sendername);SendClientMessage(playeridCinzastring);
        if(
PlayerInfo[playerid][pAdmin] == 3) return format(stringsizeof(string), "{00FF40}Admins: ({F97C00}%s{00FF40}) Nivel: ({F97C00}Admin Level 3{00FF40}) Modo: ({F97C00}Jogando{00FF40})",sendername);SendClientMessage(playeridCinzastring);
        if(
PlayerInfo[playerid][pAdmin] == 4) return format(stringsizeof(string), "{00FF40}Admins: ({F97C00}%s{00FF40}) Nivel: ({F97C00}Admin Level 4{00FF40}) Modo: ({F97C00}Jogando{00FF40})",sendername);SendClientMessage(playeridCinzastring);
        if(
PlayerInfo[playerid][pAdmin] == 1337) return format(stringsizeof(string), "{00FF40}Admins: ({F97C00}%s{00FF40}) Nivel: ({F97C00}Master{00FF40}) Modo: ({F97C00}Jogando{00FF40})",sendername);SendClientMessage(playeridCinzastring);
        if(
PlayerInfo[playerid][pAdmin] == 1339) return format(stringsizeof(string), "{00FF40}Admins: ({F97C00}%s{00FF40}) Nivel: ({F97C00}Sub-Dono{00FF40}) Modo: ({F97C00}Jogando{00FF40})",sendername);SendClientMessage(playeridCinzastring);
        if(
PlayerInfo[playerid][pAdmin] == 5000) return format(stringsizeof(string), "{00FF40}Admins: ({F97C00}%s{00FF40}) Nivel: ({F97C00}Dono{00FF40}) Modo: ({F97C00}Jogando{00FF40})",sendername);SendClientMessage(playeridCinzastring);
    }
    else if(
Trabalhando[playerid] == 1)
    {
        if(
PlayerInfo[playerid][pAdmin] == 1) return format(stringsizeof(string), "{00FF40}Admins: ({F97C00}%s{00FF40}) Nivel: ({F97C00}Moderador{00FF40}) Modo: ({F97C00}Trabalhando{00FF40})",sendername);SendClientMessage(playeridCinzastring);
        if(
PlayerInfo[playerid][pAdmin] == 2) return format(stringsizeof(string), "{00FF40}Admins: ({F97C00}%s{00FF40}) Nivel: ({F97C00}Administrador{00FF40}) Modo: ({F97C00}Trabalhando{00FF40})",sendername);SendClientMessage(playeridCinzastring);
        if(
PlayerInfo[playerid][pAdmin] == 3) return format(stringsizeof(string), "{00FF40}Admins: ({F97C00}%s{00FF40}) Nivel: ({F97C00}Admin Level 3{00FF40}) Modo: ({F97C00}Trabalhando{00FF40})",sendername);SendClientMessage(playeridCinzastring);
        if(
PlayerInfo[playerid][pAdmin] == 4) return format(stringsizeof(string), "{00FF40}Admins: ({F97C00}%s{00FF40}) Nivel: ({F97C00}Admin Level 4{00FF40}) Modo: ({F97C00}Trabalhando{00FF40})",sendername);SendClientMessage(playeridCinzastring);
        if(
PlayerInfo[playerid][pAdmin] == 1337) return format(stringsizeof(string), "{00FF40}Admins: ({F97C00}%s{00FF40}) Nivel: ({F97C00}Master{00FF40}) Modo: ({F97C00}Trabalhando{00FF40})",sendername);SendClientMessage(playeridCinzastring);
        if(
PlayerInfo[playerid][pAdmin] == 1339) return format(stringsizeof(string), "{00FF40}Admins: ({F97C00}%s{00FF40}) Nivel: ({F97C00}Sub-Dono{00FF40}) Modo: ({F97C00}Trabalhando{00FF40})",sendername);SendClientMessage(playeridCinzastring);
        if(
PlayerInfo[playerid][pAdmin] == 5000) return format(stringsizeof(string), "{00FF40}Admins: ({F97C00}%s{00FF40}) Nivel: ({F97C00}Dono{00FF40}) Modo: ({F97C00}Trabalhando{00FF40})",sendername);SendClientMessage(playeridCinzastring);
    }
    return 
1;

Reply
#2

da algum erro quando vc executa o codigo? ou quando compila? se sim, quais?
Reply
#3

Vocк tem que utilizar loop e em vez de playerid vocк usa a variбvel criada no loop, o "i' por exemplo, й muito usado.Acho que expliquei certo, mas veja um exemplo:
pawn Код:
CMD:admins(playerid, params[])
{
    SendClientMessage(playerid,0xFFF00093,"|============== Admins On‌line ============ |");
    new count = 0;
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(PlayerDados[i][pAdmin] >= 1)
        {
            new string[50];
            format(string,sizeof(string),"[Admin: %d] {F6E500}%s", PlayerDados[i][pAdmin], PlayerName(i));
            SendClientMessage(playerid,-1,string);
            count ++;
        }
    }
    if(count == 0) {  SendClientMessage(playerid,-1,"Nгo tem nenhum administrador online"); }
    SendClientMessage(playerid,0xFFF00093,"|===========================================|");
    return 1;
}
Reply
#4

ata eu esqueci do loop '-' eu tinha esquecido de fazer obrigadгo ai!
PS:Eu sei oque e loop'-'

@edit

Nem com o loop ta funfando
Reply
#5

Quote:
Originally Posted by tonisantolia
Посмотреть сообщение
Galera, fiz o comando /admins aqui mas nгo ta funfando me ajuda ai :S
PHP код:
CMD:admins(playerid,params[])
{
    new 
string[128], sendername[MAX_PLAYER_NAME];
        
GetPlayerName(playeridsendernamesizeof(sendername));
    
SendClientMessage(playerid, -1"|__{00FF40}B{FFFFFF}|{FFFF00}M{FFFFFF}|{0000FF}W{FFFFFF}____| {F97C00}ADMINS ONLINE {FFFFFF}|____{00FF40}B{FFFFFF}|{FFFF00}M{FFFFFF}|{0000FF}W{FFFFFF}__|");
    if(
Trabalhando[playerid] == 0)
    {
        if(
PlayerInfo[playerid][pAdmin] == 1) return format(stringsizeof(string), "{00FF40}Admins: ({F97C00}%s{00FF40}) Nivel: ({F97C00}Moderador{00FF40}) Modo: ({F97C00}Jogando{00FF40})",sendername);SendClientMessage(playeridCinzastring);
        if(
PlayerInfo[playerid][pAdmin] == 2) return format(stringsizeof(string), "{00FF40}Admins: ({F97C00}%s{00FF40}) Nivel: ({F97C00}Administrador{00FF40}) Modo: ({F97C00}Jogando{00FF40})",sendername);SendClientMessage(playeridCinzastring);
        if(
PlayerInfo[playerid][pAdmin] == 3) return format(stringsizeof(string), "{00FF40}Admins: ({F97C00}%s{00FF40}) Nivel: ({F97C00}Admin Level 3{00FF40}) Modo: ({F97C00}Jogando{00FF40})",sendername);SendClientMessage(playeridCinzastring);
        if(
PlayerInfo[playerid][pAdmin] == 4) return format(stringsizeof(string), "{00FF40}Admins: ({F97C00}%s{00FF40}) Nivel: ({F97C00}Admin Level 4{00FF40}) Modo: ({F97C00}Jogando{00FF40})",sendername);SendClientMessage(playeridCinzastring);
        if(
PlayerInfo[playerid][pAdmin] == 1337) return format(stringsizeof(string), "{00FF40}Admins: ({F97C00}%s{00FF40}) Nivel: ({F97C00}Master{00FF40}) Modo: ({F97C00}Jogando{00FF40})",sendername);SendClientMessage(playeridCinzastring);
        if(
PlayerInfo[playerid][pAdmin] == 1339) return format(stringsizeof(string), "{00FF40}Admins: ({F97C00}%s{00FF40}) Nivel: ({F97C00}Sub-Dono{00FF40}) Modo: ({F97C00}Jogando{00FF40})",sendername);SendClientMessage(playeridCinzastring);
        if(
PlayerInfo[playerid][pAdmin] == 5000) return format(stringsizeof(string), "{00FF40}Admins: ({F97C00}%s{00FF40}) Nivel: ({F97C00}Dono{00FF40}) Modo: ({F97C00}Jogando{00FF40})",sendername);SendClientMessage(playeridCinzastring);
    }
    else if(
Trabalhando[playerid] == 1)
    {
        if(
PlayerInfo[playerid][pAdmin] == 1) return format(stringsizeof(string), "{00FF40}Admins: ({F97C00}%s{00FF40}) Nivel: ({F97C00}Moderador{00FF40}) Modo: ({F97C00}Trabalhando{00FF40})",sendername);SendClientMessage(playeridCinzastring);
        if(
PlayerInfo[playerid][pAdmin] == 2) return format(stringsizeof(string), "{00FF40}Admins: ({F97C00}%s{00FF40}) Nivel: ({F97C00}Administrador{00FF40}) Modo: ({F97C00}Trabalhando{00FF40})",sendername);SendClientMessage(playeridCinzastring);
        if(
PlayerInfo[playerid][pAdmin] == 3) return format(stringsizeof(string), "{00FF40}Admins: ({F97C00}%s{00FF40}) Nivel: ({F97C00}Admin Level 3{00FF40}) Modo: ({F97C00}Trabalhando{00FF40})",sendername);SendClientMessage(playeridCinzastring);
        if(
PlayerInfo[playerid][pAdmin] == 4) return format(stringsizeof(string), "{00FF40}Admins: ({F97C00}%s{00FF40}) Nivel: ({F97C00}Admin Level 4{00FF40}) Modo: ({F97C00}Trabalhando{00FF40})",sendername);SendClientMessage(playeridCinzastring);
        if(
PlayerInfo[playerid][pAdmin] == 1337) return format(stringsizeof(string), "{00FF40}Admins: ({F97C00}%s{00FF40}) Nivel: ({F97C00}Master{00FF40}) Modo: ({F97C00}Trabalhando{00FF40})",sendername);SendClientMessage(playeridCinzastring);
        if(
PlayerInfo[playerid][pAdmin] == 1339) return format(stringsizeof(string), "{00FF40}Admins: ({F97C00}%s{00FF40}) Nivel: ({F97C00}Sub-Dono{00FF40}) Modo: ({F97C00}Trabalhando{00FF40})",sendername);SendClientMessage(playeridCinzastring);
        if(
PlayerInfo[playerid][pAdmin] == 5000) return format(stringsizeof(string), "{00FF40}Admins: ({F97C00}%s{00FF40}) Nivel: ({F97C00}Dono{00FF40}) Modo: ({F97C00}Trabalhando{00FF40})",sendername);SendClientMessage(playeridCinzastring);
    }
    return 
1;

Me descupe broother mais esse cуdico com loop ou sem loop nem vai funcionar !!

Nгo й precisso fazer vбrias mensagens em cada IF LOL!
Me explica +- como vocк quer essa mensagem no chat que eu fasso para vocк !
Reply
#6

Rlx, ja olhei o meu codigo e vi que nгo tinha jeito, entгo fiz outro q ta funcionando!
Reply
#7

Quote:
Originally Posted by tonisantolia
Посмотреть сообщение
Rlx, ja olhei o meu codigo e vi que nгo tinha jeito, entгo fiz outro q ta funcionando!
Opa entгo beleza mais se quiser eu posso te ajudar...
Reply
#8

pawn Код:
CMD:admins(playerid)
{
    SendClientMessage(playerid,0xFFF00093,"|============== Admins On‌line ============ |");
    new count = 0, PlayerName[MAX_PLAYER_NAME];
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(PlayerDados[i][pAdmin] >= 1)
        {
            new string[50];
            GetPlayerName(i, PlayerName, sizeof(PlayerName));
            format(string,sizeof(string),"[Admin: %d] {F6E500}%s", PlayerDados[i][pAdmin], PlayerName);
            SendClientMessage(playerid,-1,string);
            count ++;
        }
    }
    if(count == 0)
    {
        SendClientMessage(playerid,-1,"Nгo tem nenhum administrador online");
    }
    SendClientMessage(playerid,0xFFF00093,"|===========================================|");
    return 1;
}
Tente .
Reply
#9

Quote:
Originally Posted by CidadeNovaRP
Посмотреть сообщение
pawn Код:
CMD:admins(playerid)
{
    SendClientMessage(playerid,0xFFF00093,"|============== Admins On‌line ============ |");
    new count = 0, PlayerName[MAX_PLAYER_NAME];
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(PlayerDados[i][pAdmin] >= 1)
        {
            new string[50];
            GetPlayerName(i, PlayerName, sizeof(PlayerName));
            format(string,sizeof(string),"[Admin: %d] {F6E500}%s", PlayerDados[i][pAdmin], PlayerName);
            SendClientMessage(playerid,-1,string);
            count ++;
        }
    }
    if(count == 0)
    {
        SendClientMessage(playerid,-1,"Nгo tem nenhum administrador online");
    }
    SendClientMessage(playerid,0xFFF00093,"|===========================================|");
    return 1;
}
Tente .
Nгo й exatamente isto que ele quer... Se ele falou que tб BLZ tб manolo.
Reply
#10

Quote:
Originally Posted by Mr.Hardy
Посмотреть сообщение
Nгo й exatamente isto que ele quer... Se ele falou que tб BLZ tб manolo.
Desculpa, nгo fico olhando o CODE dos outros -q Vejo a dъvida e a respondo, foi mal nгo tinha lido .
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)