[Ajuda] /pegararmas
#1

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;
    }
Reply
#2

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.
Reply
#3

Em que parte do comando tenho que por esse Ultimo Code ?
Reply
#4

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;
    }
Reply
#5

Mande a public "ReduceTimer".
Reply
#6

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

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..) ??
Reply
#8

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;
    }
Reply
#9

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

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;
    }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)