[Ajuda] comando /orgs
#1

BOM Pessoal Vim Pedi Ajuda de vcs ja tentei de tudo tipo

eu queria colocao meu /orgs pra aparecer os lider de cada orgs no caso fiz como profissao podem mim ajuda prf?
precisa de algunha variavel so fala

pawn Код:
if(strcmp(cmd, "/orgs", true) == 0)
    {
        new strcmd[1000];
        strcat(strcmd, "{3333FF}Forca Aerea Brasileira\n", sizeof(strcmd));
        strcat(strcmd, "{99FFFF}swat\n", sizeof(strcmd));
        strcat(strcmd, "{666666}Piratas\n", sizeof(strcmd));
        strcat(strcmd, "{218200}Exercito\n", sizeof(strcmd));
        strcat(strcmd, "{FF8306}Elite Aerea\n", sizeof(strcmd));
        strcat(strcmd, "{A60000}Comando Vermelho\n", sizeof(strcmd));
        strcat(strcmd, "{FF00FF}La Cosa Nostra\n", sizeof(strcmd));
        strcat(strcmd, "{FF0000}Yakuza\n", sizeof(strcmd));
        strcat(strcmd, "{7777FF}Bope\n", sizeof(strcmd));
        strcat(strcmd, "{00FFFF}Marinha\n", sizeof(strcmd));
        strcat(strcmd, "{33CCFF}Policia Rodoviaria Federal\n", sizeof(strcmd));
        strcat(strcmd, "{F4F400}FBI\n", sizeof(strcmd));
        strcat(strcmd, "{989758}Al Qaeda\n", sizeof(strcmd));
        strcat(strcmd, "{09FF46}Panico Na BanD\n", sizeof(strcmd));
        strcat(strcmd, "{5151A2}Policia G.A.T.E\n", sizeof(strcmd));
        ShowPlayerDialog(playerid, orgs, DIALOG_STYLE_MSGBOX, "Org List", strcmd, "Ok", "");
        return 1;
    }
Reply
#2

Vocк pode criar outra string e usar format para adicionar o nome do lнder...
Reply
#3

pode mim da uma dica por ja tentei de tudo
Reply
#4

Exemplo:
pawn Код:
new string1[50], string2[50];
format(string1, sizeof string1,"Usuбrio %s", "MultiKill");
strcat(string2, string1, sizeof(string2));
Reply
#5

Nao Entendi Kill :/ pode da um exp usando o cod pra mim estudar?

Precisa do /darlider ta ae


pawn Код:
if(strcmp(cmd,"/darlider", true)==0)
    {
        if(pAdmin[playerid] == 5 || AdminGeral[playerid] == 1)
        {
        new id, orgid;
        if(sscanf(cmdtext, "s[10]ud", cmd, id, orgid))
        {
            SendClientMessage(playerid, Vermelho, "(ERRO) Digite: /darlider [id] [0-14]");
        }
        if(!IsPlayerConnected( id ))
        {
            SendClientMessage(playerid, Vermelho, "(ERRO) Player Invalido");
        }
        if(0 > orgid || orgid > 14)
        {
            SendClientMessage(playerid, Vermelho, "(ERRO) Digite: /darlider [id] [0-14]");
            return 1;
        }
        format(file, sizeof(file), PASTA_CONTAS, GetPlayerNameEx( id ));
        dini_IntSet(file,"lider", 1);
        lider[ id ] = 1;
        dini_IntSet(file, "Profissao", orgid);
        format(string, sizeof(string), "O(A) Administrador %s (%d) promoveu: %s (%d) para lider da organizaзгo: %s!", GetPlayerNameEx( playerid ), playerid, GetPlayerNameEx( id ), id, GetOrgName(orgid));
        SendClientMessageToAll(tcadm, string);
        SpawnPlayer(id);
        }
        else
        {
        SendClientMessage(playerid, Vermelho, "(ERRO) Vocк nгo tem permissгo.");
        }
        return 1;
    }
Reply
#6

Vocк precisa criar um variбvel para armazenar a mensagem formatada. E precisa de uma funзгo para pegar o nome do lнder dentro de um arquivo, ou a variбvel que fica armazenada o nome do lнder.
pawn Код:
new Lider_Forca_Aerea[] = "Multi"; // A variбvel string que fica armazenada o nome do lнder.

new Lider_Swat[] = "Kill"; // A variбvel string que fica armazenada o nome do lнder.

format(string, sizeof string, "{3333FF}Forca Aerea Brasileira - Lider: %s\n", Lider_Forca_Aerea); // armazena a mensagem na variбvel string.

strcat(strcmd, , sizeof(strcmd)); // Coloca a mensagem da variбvel string na variбvel strcmd.

format(string, sizeof string, "{99FFFF}swat - Lider: %s\n",Lider_Swat); // armazena a mensagem na variбvel string.

strcat(strcmd, , sizeof(strcmd)); // Coloca a mensagem da variбvel string na variбvel strcmd.

ShowPlayerDialog(playerid, orgs, DIALOG_STYLE_MSGBOX, "Org List", strcmd, "Ok", ""); // Exibe o diбlogo para o
jogador.
Espero que tenha entendido, cada organizaзгo terб que ter um arquivo, e nesse arquivo conter o nome do lнder, e vocк ira usar a funзгo dini_Get("Nome_Arquivo", "Lider"), jб que usa dini.
pawn Код:
format(string, sizeof string, "Lider: %s", dini_Get("Nome_Arquivo", "Lider"));
Estude um pouco sobre format.
Reply
#7

o kill so que nao salva o nome do lider nao e tipo uma profissao tlg

da uma olhada ae nos cods

pawn Код:
// Profissхes
#define FA 0
#define swat 1
#define PIR 2
#define EXT 3
#define AE 4
#define CV 5
#define LCN 6
#define YKZ 7
#define Bope 8
#define Mar 9
#define Policial_R 10
#define FBI 11
#define AQ 12
#define PNBanD 13
#define Gate 14

if(strcmp("/alistar", cmd, true) == 0)
    {
        if(lider[playerid] == 1 || sublider[playerid] == 1)
        {
            new plid;

            if(sscanf(cmdtext, "s[12]ud", cmd, plid))
            {
                SendClientMessage(playerid, Vermelho, "Digite: /alistar [id]");
                return 1;
            }
            if(IsPlayerConnected(plid))
            {
                if(PlayerInfo[playerid][_Profissao] == 0)
                {
                    format(file2, sizeof(file2), PASTA_CONTAS, GetPlayerNameEx(plid));
                    dini_IntSet(file2, "Profissao", 0);
                    format(string, sizeof(string), "%s te alistou para a organizaзгo: Forзa Aerea.", GetPlayerNameEx(playerid));
                    SendClientMessage(playerid, COLOR_GREEN, "Comando efetuado com sucesso.");
                    SendClientMessage(plid, 0x33CCFFAA, string);
                    Logarprof(plid);
                }
                if(PlayerInfo[playerid][_Profissao] == 1)
                {
                    format(file2, sizeof(file2), PASTA_CONTAS, GetPlayerNameEx(plid));
                    dini_IntSet(file2, "Profissao", 1);
                    format(string, sizeof(string), "%s te alistou para a organizaзгo: swat.", GetPlayerNameEx(playerid));
                    SendClientMessage(playerid, COLOR_GREEN, "Comando efetuado com sucesso.");
                    SendClientMessage(plid, 0x33CCFFAA, string);
                    Logarprof(plid);
                }
                if(PlayerInfo[playerid][_Profissao] == 2)
                {
                    format(file2, sizeof(file2), PASTA_CONTAS, GetPlayerNameEx(plid));
                    dini_IntSet(file2, "Profissao", 2);
                    format(string, sizeof(string), "%s te alistou para a organizaзгo: PIR.", GetPlayerNameEx(playerid));
                    SendClientMessage(playerid, COLOR_GREEN, "Comando efetuado com sucesso.");
                    SendClientMessage(plid, 0x666666, string);
                    Logarprof(plid);
                }
                if(PlayerInfo[playerid][_Profissao] == 3)
                {
                    format(file2, sizeof(file2), PASTA_CONTAS, GetPlayerNameEx(plid));
                    dini_IntSet(file2, "Profissao", 3);
                    format(string, sizeof(string), "%s te alistou para a organizaзгo: Exercito.", GetPlayerNameEx(playerid));
                    SendClientMessage(playerid, COLOR_GREEN, "Comando efetuado com sucesso.");
                    SendClientMessage(plid, 0x33CCFFAA, string);
                    Logarprof(plid);
                }
                if(PlayerInfo[playerid][_Profissao] == 4)
                {
                    format(file2, sizeof(file2), PASTA_CONTAS, GetPlayerNameEx(plid));
                    dini_IntSet(file2, "Profissao", 4);
                    format(string, sizeof(string), "%s te alistou para a organizaзгo: Elite Aerea.", GetPlayerNameEx(playerid));
                    SendClientMessage(playerid, COLOR_GREEN, "Comando efetuado com sucesso.");
                    SendClientMessage(plid, 0x33CCFFAA, string);
                    Logarprof(plid);
                }
                if(PlayerInfo[playerid][_Profissao] == 5)
                {
                    format(file2, sizeof(file2), PASTA_CONTAS, GetPlayerNameEx(plid));
                    dini_IntSet(file2, "Profissao", 5);
                    format(string, sizeof(string), "%s te alistou para a organizaзгo: Comando Vermelho.", GetPlayerNameEx(playerid));
                    SendClientMessage(playerid, COLOR_GREEN, "Comando efetuado com sucesso.");
                    SendClientMessage(plid, 0x33CCFFAA, string);
                    Logarprof(plid);
                }
                if(PlayerInfo[playerid][_Profissao] == 6)
                {
                    format(file2, sizeof(file2), PASTA_CONTAS, GetPlayerNameEx(plid));
                    dini_IntSet(file2, "Profissao", 6);
                    format(string, sizeof(string), "%s te alistou para a organizaзгo: La Cosa Nostra.", GetPlayerNameEx(playerid));
                    SendClientMessage(playerid, COLOR_GREEN, "Comando efetuado com sucesso.");
                    SendClientMessage(plid, 0x33CCFFAA, string);
                    Logarprof(plid);
                }
                if(PlayerInfo[playerid][_Profissao] == 7)
                {
                    format(file2, sizeof(file2), PASTA_CONTAS, GetPlayerNameEx(plid));
                    dini_IntSet(file2, "Profissao", 7);
                    format(string, sizeof(string), "%s te alistou para a organizaзгo: Yakuza.", GetPlayerNameEx(playerid));
                    SendClientMessage(playerid, COLOR_GREEN, "Comando efetuado com sucesso.");
                    SendClientMessage(plid, 0x33CCFFAA, string);
                    Logarprof(plid);
                }
                if(PlayerInfo[playerid][_Profissao] == 8)
                {
                    format(file2, sizeof(file2), PASTA_CONTAS, GetPlayerNameEx(plid));
                    dini_IntSet(file2, "Profissao", 8);
                    format(string, sizeof(string), "%s te alistou para a organizaзгo: Bope.", GetPlayerNameEx(playerid));
                    SendClientMessage(playerid, COLOR_GREEN, "Comando efetuado com sucesso.");
                    SendClientMessage(plid, 0x33CCFFAA, string);
                    Logarprof(plid);
                }
                if(PlayerInfo[playerid][_Profissao] == 9)
                {
                    format(file2, sizeof(file2), PASTA_CONTAS, GetPlayerNameEx(plid));
                    dini_IntSet(file2, "Profissao", 9);
                    format(string, sizeof(string), "%s te alistou para a organizaзгo: Mar.", GetPlayerNameEx(playerid));
                    SendClientMessage(playerid, COLOR_GREEN, "Comando efetuado com sucesso.");
                    SendClientMessage(plid, 0x33CCFFAA, string);
                    Logarprof(plid);
                }
                if(PlayerInfo[playerid][_Profissao] == 10)
                {
                    format(file2, sizeof(file2), PASTA_CONTAS, GetPlayerNameEx(plid));
                    dini_IntSet(file2, "Profissao", 10);
                    format(string, sizeof(string), "%s te alistou para a organizaзгo: Policia Rodoviaria Federal.", GetPlayerNameEx(playerid));
                    SendClientMessage(playerid, COLOR_GREEN, "Comando efetuado com sucesso.");
                    SendClientMessage(plid, 0x0069D2FF, string);
                    Logarprof(plid);
                }
                if(PlayerInfo[playerid][_Profissao] == 11)
                {
                    format(file2, sizeof(file2), PASTA_CONTAS, GetPlayerNameEx(plid));
                    dini_IntSet(file2, "Profissao", 11);
                    format(string, sizeof(string), "%s te alistou para a organizaзгo: FBI.", GetPlayerNameEx(playerid));
                    SendClientMessage(playerid, COLOR_GREEN, "Comando efetuado com sucesso.");
                    SendClientMessage(plid, 0xB0B000AA, string);
                    Logarprof(plid);
                }
                if(PlayerInfo[playerid][_Profissao] == 12)
                {
                    format(file2, sizeof(file2), PASTA_CONTAS, GetPlayerNameEx(plid));
                    dini_IntSet(file2, "Profissao", 12);
                    format(string, sizeof(string), "%s te alistou para a organizaзгo: AQ.", GetPlayerNameEx(playerid));
                    SendClientMessage(playerid, COLOR_GREEN, "Comando efetuado com sucesso.");
                    SendClientMessage(plid, 0x989758FF, string);
                    Logarprof(plid);
                }
                if(PlayerInfo[playerid][_Profissao] == 13)
                {
                    format(file2, sizeof(file2), PASTA_CONTAS, GetPlayerNameEx(plid));
                    dini_IntSet(file2, "Profissao", 13);
                    format(string, sizeof(string), "%s te alistou para A TV: Panico Na Bande.", GetPlayerNameEx(playerid));
                    SendClientMessage(playerid, COLOR_GREEN, "Comando efetuado com sucesso.");
                    SendClientMessage(plid, 0x989758FF, string);
                    Logarprof(plid);
                }
                if(PlayerInfo[playerid][_Profissao] == 14)
                {
                    format(file2, sizeof(file2), PASTA_CONTAS, GetPlayerNameEx(plid));
                    dini_IntSet(file2, "Profissao", 14);
                    format(string, sizeof(string), "%s te alistou para o: Gate.", GetPlayerNameEx(playerid));
                    SendClientMessage(playerid, COLOR_GREEN, "Comando efetuado com sucesso.");
                    SendClientMessage(plid, 0x989758FF, string);
                    Logarprof(plid);
                }
            }
            else
            {
                SendClientMessage(playerid, Vermelho, "Jogador nгo conectado!");
            }
        }

        return 1;
    }

    if(strcmp(cmd,"/demitir", true)==0)
    {
    new aname[MAX_PLAYER_NAME];
    new pname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, aname, MAX_PLAYER_NAME);
    if(lider[playerid] == 1 || sublider[playerid] ==1)
    {
        new tmp[256], plid;
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp))
        {
            SendClientMessage(playerid, Vermelho, "(ERRO) Digite: /demitir [id]");
            return 1;
        }
        plid = strval(tmp);
        GetPlayerName(plid, pname, MAX_PLAYER_NAME);
        format(file, sizeof(file), PASTA_CONTAS, pname);
        dini_IntSet(file, "Profissao", 74);
        Logarprof(playerid);
        SpawnPlayer(plid);
        format(string, sizeof(string), "{FFF700}%s(%d) demitiu %s(%d) da sua organizaзгo!", aname,playerid, pname, plid);
        SendClientMessage(playerid, COLOR_GREEN, "Comando efetuado com sucesso.");
        SendClientMessageToAll(tcadm, string);
    }
    else
    {
        SendClientMessage(playerid, Vermelho, "(ERRO) Vocк nгo tem permissгo.");
    }
    return 1;
    }
Reply
#8

Pelo que percebi cada organizaзгo nгo tem um arquivo, se quiser mostrar o lнder de cada organizaзгo crie um arquivo para cada organizaзгo, sem um arquivo para cada organizaзгo, sу serб possнvel verificar o lнder de cada organizaзгo por variбveis strings, e ainda quando o servidor for iniciado vocк terб que setar manualmente cada lнder para cada variбvel que armazena o lнder da organizaзгo.

E depois de criado o arquivo, quando for dar lнder para uma organizaзгo, use a funзгo da include que vocк usa para salvar, para setar no arquivo da organizaзгo, o nome do novo lнder.
Reply
#9

pode mim ajuda com uma base pra mim fazer em todas?
Reply
#10

Vou lhe ajudar com uma organizaзгo o resto vocк faz.
Na callback OnGameModeInit:
pawn Код:
if(!dini_Exists("Swat.ini")) // Verifica se o arquivo Swat.ini existe. Este й o arquivo da organizaзгo Swat
{
    //Caso nгo exista:
    dini_Create("Swat.ini"); // Caso nгo exista cria o arquivo.
    dini_Set("Swat.ini", "Lider", "Ninguem"); // Depois do arquivo criado, Seta em uma linha a tag Lider e Ninguem. Ficando Lider=Ninguem
}
Dando Lнder:
pawn Код:
if(strcmp(cmd,"/darlider", true)==0)
{
    new nome[25]; // Cria a variбvel local string para armazenar o nome do jogador.
    GetPlayerName(playerid, nome, 24); // Pega o nome do jogador e armazena na variбvel string nome.
    dini_Set("Swat.ini", "Lider", nome); // Seta na tag Lider o nome que estб armazenado na variбvel string nome.
    return 1;
}
Demitir Lнder:
pawn Код:
f(strcmp(cmd,"/demitir", true)==0)
{
    dini_Set("Swat.ini", "Lider", "Ninguem"); // Seta na tag Lider a palavra Ninguem;
    return 1;
}
Comando orgs:
pawn Код:
if(strcmp(cmd, "/orgs", true) == 0)
{
    new strcmd[1000], string[150];
    format(string, sizeof string, "Swat - Lнder: %s", dini_Get("Swat.ini", "Lider")); // Formata e armazena na variбvel string.
    strcat(strcmd, string, sizeof(strcmd)); // armazena mais uma linha na variбvel string strcmd.
    strcat(strcmd, "{666666}Piratas\n", sizeof(strcmd)); // armazena mais uma linha na variбvel string strcmd.
    ShowPlayerDialog(playerid, orgs, DIALOG_STYLE_MSGBOX, "Org List", strcmd, "Ok", ""); // Exibe o diбlogo.
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)