SA-MP Forums Archive
[Ajuda] /anorg (Anuncio das Orgs) - 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] /anorg (Anuncio das Orgs) (/showthread.php?tid=329021)



[Ajuda] /anorg (Anuncio das Orgs) - JuniorRiddle - 26.03.2012

Queria criar um sistema de anuncios de orgs, um unico comando que quando o player digitasse mandasse o anuncio da sua org, sou meio novato entгo nгo sei se to fazendo certo, mas tentei modificar um /ang que achei na net.

O Comando ficou assim:

pawn Код:
if(strcmp(cmd, "/anorg", true) == 0 || strcmp(cmd, "/anorg", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(GetPlayerOrg(playerid) == 8 || GetPlayerOrg(playerid) == 5)
            {
                if(PlayerInfo[playerid][pCargo] < 4)
                {
                    SendClientMessage(playerid, COLOR_GREY, "Voce precisa ter pelo menos cargo 4 para usar este comando!");
                    return 1;
                }
                new length = strlen(cmdtext);
                while ((idx < length) && (cmdtext[idx] <= ' '))
                {
                    idx++;
                }
                new offset = idx;
                new result[64];
                while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
                {
                    result[idx - offset] = cmdtext[idx];
                    idx++;
                }
                result[idx - offset] = EOS;
                if(!strlen(result))
                {
                    SendClientMessage(playerid, COLOR_GRAD2, "USE: (/ang) ou (/anunciogang) [texto]");
                    return 1;
                }
                if(TentouDivulgar(result))
                {
                if(cdivulgar[playerid] >= 4)
                {
                }
                GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
                format(string, 128, "AdmAviso: [%d]%s tentou divulgar: %s.",playerid,playername,result);
                ABroadCast(COLOR_YELLOW,string,1);
                DivulgouLog(string);
                cdivulgar[playerid] += 1;
                return 1;
                }
                if(panunciogang == 1)
                {
                    SendClientMessage(playerid,COLOR_GRAD2,"Espere 60 segundos para poder anunciar novamente!");
                    return 1;
                }
                if (PlayerInfo[playerid][pLider] == 8 || PlayerInfo[playerid][pMembro] == 8) // Mбfia Cosa Nostra
                GetPlayerName(playerid, sendername, MAX_PLAYER_NAME);
                SendClientMessageToAll(COLOR_GREY, "|______________ Anъncio OOC Hitmans ______________|");
                format(string, sizeof(string), "Assassino: %s", result);
                SendClientMessageToAll(COLOR_GREY, string);
                print(string);
                SBizzInfo[7][sbTill] += 30;
                ExtortionSBiz(7, 30);
                panunciogang = 1;
                TempoAnGang = SetTimer("AnuncioGang", 60000, 0);
               

                if (PlayerInfo[playerid][pLider] == 5 || PlayerInfo[playerid][pMembro] == 5) // Mбfia Cosa Nostra
                GetPlayerName(playerid, sendername, MAX_PLAYER_NAME);
                SendClientMessageToAll(0x0000CCF6, "|______________ Anъncio OOC Varrio Los Aztecas ______________|");
                format(string, sizeof(string), "Gangster %s: %s", sendername, result);
                SendClientMessageToAll(COLOR_WHITE, string);
                print(string);
                SBizzInfo[7][sbTill] += 30;
                ExtortionSBiz(7, 30);
                panunciogang = 1;
                TempoAnGang = SetTimer("AnuncioGang", 60000, 0);
                }
        }
        return 1;
O erro й o seguinte, quando uma player usa o /anorg sгo mandados todos os anъncios setados!

Imagem do Erro, sгo mandandos todos os anuncios setados!
/imageshack/img535/2025/samp002ly.png


Re: [Ajuda] /anorg (Anuncio das Orgs) - marcelodell - 26.03.2012

pawn Код:
if(strcmp(cmd, "/anorg", true) == 0 || strcmp(cmd, "/anorg", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(GetPlayerOrg(playerid) == 8 || GetPlayerOrg(playerid) == 5)
            {
                if(PlayerInfo[playerid][pCargo] < 4)
                {
                    SendClientMessage(playerid, COLOR_GREY, "Voce precisa ter pelo menos cargo 4 para usar este comando!");
                    return 1;
                }
                new length = strlen(cmdtext);
                while ((idx < length) && (cmdtext[idx] <= ' '))
                {
                    idx++;
                }
                new offset = idx;
                new result[64];
                while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
                {
                    result[idx - offset] = cmdtext[idx];
                    idx++;
                }
                result[idx - offset] = EOS;
                if(!strlen(result))
                {
                    SendClientMessage(playerid, COLOR_GRAD2, "USE: (/ang) ou (/anunciogang) [texto]");
                    return 1;
                }
                if(TentouDivulgar(result))
                {
                    GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
                    format(string, 128, "AdmAviso: [%d]%s tentou divulgar: %s.",playerid,playername,result);
                    ABroadCast(COLOR_YELLOW,string,1);
                    DivulgouLog(string);
                    cdivulgar[playerid] += 1;
                    return 1;
                }
                if(panunciogang == 1)
                {
                    SendClientMessage(playerid,COLOR_GRAD2,"Espere 60 segundos para poder anunciar novamente!");
                    return 1;
                }
                if  (PlayerInfo[playerid][pLider] == 8 || PlayerInfo[playerid][pMembro] == 8) // Mбfia Cosa Nostra
                {
                    GetPlayerName(playerid, sendername, MAX_PLAYER_NAME);
                    SendClientMessageToAll(COLOR_GREY, "|______________ Anъncio OOC Hitmans ______________|");
                    format(string, sizeof(string), "Assassino: %s", result);
                    SendClientMessageToAll(COLOR_GREY, string);
                    print(string);
                    SBizzInfo[7][sbTill] += 30;
                    ExtortionSBiz(7, 30);
                    panunciogang = 1;
                    TempoAnGang = SetTimer("AnuncioGang", 60000, 0);
                }
                if (PlayerInfo[playerid][pLider] == 5 || PlayerInfo[playerid][pMembro] == 5) // Mбfia Cosa Nostra
                {
                    GetPlayerName(playerid, sendername, MAX_PLAYER_NAME);
                    SendClientMessageToAll(0x0000CCF6, "|______________ Anъncio OOC Varrio Los Aztecas ______________|");
                    format(string, sizeof(string), "Gangster %s: %s", sendername, result);
                    SendClientMessageToAll(COLOR_WHITE, string);
                    print(string);
                    SBizzInfo[7][sbTill] += 30;
                    ExtortionSBiz(7, 30);
                    panunciogang = 1;
                    TempoAnGang = SetTimer("AnuncioGang", 60000, 0);
                }
            }
        }
        return 1;
    }
Espero que funcione =D


Re: [Ajuda] /anorg (Anuncio das Orgs) - JuniorRiddle - 26.03.2012

Ficou perfeito amigгo, valeu ai, rep para vocк!