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



[Ajuda] /pegararmas - Felipe_Wesker - 06.05.2011

Olб, eu tenho um comando aki, sу que n sei onde estб o prblema, a pessoa pode floodar esse comando, e pegar muitas armas.. quero q ela possa usar o comando uma vez sу:

pawn Код:
if(strcmp(cmd, "/pegararmas", true) == 0)
    {
        if(ReduceTime[playerid] == 1)
        {
                   SendClientMessage(playerid, COLOR_GREY, " Saia e entre novamente na HQ para pegar armas, mas nao abuse!");
                   return 1;
        }
        else if(PlayerInfo[playerid][pMember] == 16 && PlayerToPoint(8.0,playerid,1269.2566,-782.9906,1084.0149))
        {
            GetPlayerName(playerid,sendername,256);
            ReduceTime[playerid] = 1;
            format(string, 256, "%s Pegou armas",sendername);
            ProxDetector(50.0,playerid,string,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
            GivePlayerWeapon(playerid, 24, 10);
            GivePlayerWeapon(playerid, 29, 500);
            GivePlayerWeapon(playerid, 30, 250);
            SetTimerEx("ReduceTimer", 10000, false, "i", playerid);
        }
        else if(PlayerInfo[playerid][pMember] == 17 && PlayerToPoint(8.0,playerid,-2166.3108,645.9502,1052.3750))
        {
            GetPlayerName(playerid,sendername,256);
            ReduceTime[playerid] = 1;
            format(string, 256, "%s Pegou armas",sendername);
            ProxDetector(50.0,playerid,string,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
            GivePlayerWeapon(playerid, 24, 10);
            GivePlayerWeapon(playerid, 29, 500);
            GivePlayerWeapon(playerid, 30, 250);
            SetTimerEx("ReduceTimer", 10000, false, "i", playerid);
        }
        else if(PlayerInfo[playerid][pMember] == 8 && PlayerToPoint(8.0,playerid,1714.2894,-1663.4102,20.2280) || PlayerToPoint(8.0,playerid,449.0826,-80.9784,999.5547))
        {
            GetPlayerName(playerid,sendername,256);
            ReduceTime[playerid] = 1;
            format(string, 256, "%s Pegou armas",sendername);
            ProxDetector(50.0,playerid,string,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
            GivePlayerWeapon(playerid, 4, 1);
            GivePlayerWeapon(playerid, 24, 100);
            GivePlayerWeapon(playerid, 34, 150);
            GivePlayerWeapon(playerid, 30, 200);
            GivePlayerWeapon(playerid, 31, 200);
            GivePlayerWeapon(playerid, 29, 500);
            GivePlayerWeapon(playerid, 25, 150);
            SetTimerEx("ReduceTimer", 10000, false, "i", playerid);
        }
        return 1;
    }



Re: /pegararmas, ajuda - JonathanFeitosa - 06.05.2011

Usa Variavel.
Topo
pawn Код:
new JFS[MAX_PLAYERS];
No Comando
pawn Код:
JFS[playerid] ++;
if(JFS[playerid] == 1) return SendClientMessage(playerid, Cor, " Vocк Nгo Pode Usar Estй Comando Denovo  :C");
Acho que Pega, Nгo testado.


Re: /pegararmas, ajuda - Felipe_Wesker - 06.05.2011

Em que parte do comando tenho que por esse Ultimo Code ?


Re: /pegararmas, ajuda - JonathanFeitosa - 06.05.2011

pawn Код:
if(strcmp(cmd, "/pegararmas", true) == 0)
    {
        if(JFS[playerid] == 1) return SendClientMessage(playerid, Cor, " Vocк Nгo Pode Usar Estй Comando Denovo  :C");
        if(ReduceTime[playerid] == 1)
        {
                   SendClientMessage(playerid, COLOR_GREY, " Saia e entre novamente na HQ para pegar armas, mas nao abuse!");
                   return 1;
        }
        else if(PlayerInfo[playerid][pMember] == 16 && PlayerToPoint(8.0,playerid,1269.2566,-782.9906,1084.0149))
        {
            GetPlayerName(playerid,sendername,256);
            ReduceTime[playerid] = 1;
            format(string, 256, "%s Pegou armas",sendername);
            ProxDetector(50.0,playerid,string,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
            GivePlayerWeapon(playerid, 24, 10);
            GivePlayerWeapon(playerid, 29, 500);
            GivePlayerWeapon(playerid, 30, 250);
            SetTimerEx("ReduceTimer", 10000, false, "i", playerid);
        }
        else if(PlayerInfo[playerid][pMember] == 17 && PlayerToPoint(8.0,playerid,-2166.3108,645.9502,1052.3750))
        {
            GetPlayerName(playerid,sendername,256);
            ReduceTime[playerid] = 1;
            format(string, 256, "%s Pegou armas",sendername);
            ProxDetector(50.0,playerid,string,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
            GivePlayerWeapon(playerid, 24, 10);
            GivePlayerWeapon(playerid, 29, 500);
            GivePlayerWeapon(playerid, 30, 250);
            SetTimerEx("ReduceTimer", 10000, false, "i", playerid);
        }
        else if(PlayerInfo[playerid][pMember] == 8 && PlayerToPoint(8.0,playerid,1714.2894,-1663.4102,20.2280) || PlayerToPoint(8.0,playerid,449.0826,-80.9784,999.5547))
        {
            GetPlayerName(playerid,sendername,256);
            ReduceTime[playerid] = 1;
            format(string, 256, "%s Pegou armas",sendername);
            ProxDetector(50.0,playerid,string,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
            GivePlayerWeapon(playerid, 4, 1);
            GivePlayerWeapon(playerid, 24, 100);
            GivePlayerWeapon(playerid, 34, 150);
            GivePlayerWeapon(playerid, 30, 200);
            GivePlayerWeapon(playerid, 31, 200);
            GivePlayerWeapon(playerid, 29, 500);
            GivePlayerWeapon(playerid, 25, 150);
            SetTimerEx("ReduceTimer", 10000, false, "i", playerid);
        }
        JFS[playerid] ++;
        return 1;
    }



Re: /pegararmas, ajuda - Shadoww5 - 06.05.2011

Mande a public "ReduceTimer".


Re: /pegararmas, ajuda - Felipe_Wesker - 06.05.2011

pawn Код:
public ReduceTimer(playerid)
{
    if(IsPlayerConnected(playerid))
    {
        if(ReduceTime[playerid] == 1)
        {
            ReduceTime[playerid] = 0;
        }
    }
}



Re: [Ajuda] /pegararmas - Felipe_Wesker - 07.05.2011

JSF atй q funfa, mas tem outro problema:

A pessoa nao pode usar esse comando por tada a HQ, й sу numa devida cordenada que ninguem sabe.. Entao se a pessoa nasce na HQ, tenta usar o comando e ela falha (nao ganha armas) dai qndo ela vai tentar dinovo e acerta, diz q o comando ta bloqueado.. Como faзo para poder dar esse /pegararmas sem falhas ( em toda a HQ, como aumentar essas cordenadas para toda uma бrea..) ??


Re: [Ajuda] /pegararmas - JonathanFeitosa - 07.05.2011

pawn Код:
if(strcmp(cmd, "/pegararmas", true) == 0)
    {
        if(PlayerToPoint(10.0,playerid,1269.2566,-782.9906,1084.0149))
        {
        if(JFS[playerid] == 1) return SendClientMessage(playerid, Cor, " Vocк Nгo Pode Usar Estй Comando Denovo  :C");
        if(ReduceTime[playerid] == 1) return SendClientMessage(playerid, COLOR_GREY, " Saia e entre novamente na HQ para pegar armas, mas nao abuse!");
        else if(PlayerInfo[playerid][pMember] == 16)
        {
            GetPlayerName(playerid,sendername,256);
            ReduceTime[playerid] = 1;
            format(string, 256, "%s Pegou armas",sendername);
            ProxDetector(50.0,playerid,string,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
            GivePlayerWeapon(playerid, 24, 10);
            GivePlayerWeapon(playerid, 29, 500);
            GivePlayerWeapon(playerid, 30, 250);
            SetTimerEx("ReduceTimer", 10000, false, "i", playerid);
        }
        else if(PlayerInfo[playerid][pMember] == 17 && PlayerToPoint(8.0,playerid,-2166.3108,645.9502,1052.3750))
        {
            GetPlayerName(playerid,sendername,256);
            ReduceTime[playerid] = 1;
            format(string, 256, "%s Pegou armas",sendername);
            ProxDetector(50.0,playerid,string,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
            GivePlayerWeapon(playerid, 24, 10);
            GivePlayerWeapon(playerid, 29, 500);
            GivePlayerWeapon(playerid, 30, 250);
            SetTimerEx("ReduceTimer", 10000, false, "i", playerid);
        }
        else if(PlayerInfo[playerid][pMember] == 8 && PlayerToPoint(8.0,playerid,1714.2894,-1663.4102,20.2280) || PlayerToPoint(8.0,playerid,449.0826,-80.9784,999.5547))
        {
            GetPlayerName(playerid,sendername,256);
            ReduceTime[playerid] = 1;
            format(string, 256, "%s Pegou armas",sendername);
            ProxDetector(50.0,playerid,string,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
            GivePlayerWeapon(playerid, 4, 1);
            GivePlayerWeapon(playerid, 24, 100);
            GivePlayerWeapon(playerid, 34, 150);
            GivePlayerWeapon(playerid, 30, 200);
            GivePlayerWeapon(playerid, 31, 200);
            GivePlayerWeapon(playerid, 29, 500);
            GivePlayerWeapon(playerid, 25, 150);
            SetTimerEx("ReduceTimer", 10000, false, "i", playerid);
        }
        JFS[playerid] ++;
        }
        return 1;
    }



Re: [Ajuda] /pegararmas - Felipe_Wesker - 08.05.2011

JSF deu erro que fecha o pawno, nem mostra oq deu errado sahsuausha..


Re: [Ajuda] /pegararmas - Transferencia - 08.05.2011

tenta
pawn Код:
if(strcmp(cmd, "/pegararmas", true) == 0)
    {
        if(PlayerToPoint(10.0,playerid,1269.2566,-782.9906,1084.0149))
        {
        if(JFS[playerid] == 1) return SendClientMessage(playerid, Cor, " Vocк Nгo Pode Usar Estй Comando Denovo  :C");
        if(ReduceTime[playerid] == 1) return SendClientMessage(playerid, COLOR_GREY, " Saia e entre novamente na HQ para pegar armas, mas nao abuse!");
        else if(PlayerInfo[playerid][pMember] == 16)
        {
            GetPlayerName(playerid,sendername,256);
            ReduceTime[playerid] = 1;
            format(string, 256, "%s Pegou armas",sendername);
            ProxDetector(50.0,playerid,string,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
            GivePlayerWeapon(playerid, 24, 10);
            GivePlayerWeapon(playerid, 29, 500);
            GivePlayerWeapon(playerid, 30, 250);
            SetTimerEx("ReduceTimer", 10000, false, "i", playerid);
        }
        else if(PlayerInfo[playerid][pMember] == 17 && PlayerToPoint(8.0,playerid,-2166.3108,645.9502,1052.3750))
        {
            GetPlayerName(playerid,sendername,256);
            ReduceTime[playerid] = 1;
            format(string, 256, "%s Pegou armas",sendername);
            ProxDetector(50.0,playerid,string,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
            GivePlayerWeapon(playerid, 24, 10);
            GivePlayerWeapon(playerid, 29, 500);
            GivePlayerWeapon(playerid, 30, 250);
            SetTimerEx("ReduceTimer", 10000, false, "i", playerid);
        }
        else if(PlayerInfo[playerid][pMember] == 8 && PlayerToPoint(8.0,playerid,1714.2894,-1663.4102,20.2280) || PlayerToPoint(8.0,playerid,449.0826,-80.9784,999.5547))
        {
            GetPlayerName(playerid,sendername,256);
            ReduceTime[playerid] = 1;
            format(string, 256, "%s Pegou armas",sendername);
            ProxDetector(50.0,playerid,string,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
            GivePlayerWeapon(playerid, 4, 1);
            GivePlayerWeapon(playerid, 24, 100);
            GivePlayerWeapon(playerid, 34, 150);
            GivePlayerWeapon(playerid, 30, 200);
            GivePlayerWeapon(playerid, 31, 200);
            GivePlayerWeapon(playerid, 29, 500);
            GivePlayerWeapon(playerid, 25, 150);
            SetTimerEx("ReduceTimer", 10000, false, "i", playerid);
        }
        JFS[playerid] ++;
        }
        }
        }
        return 1;
    }