SA-MP Forums Archive
[ajuda] como colocar tempo entre os /an - 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] como colocar tempo entre os /an (/showthread.php?tid=179213)



[ajuda] como colocar tempo entre os /an - lucas_mdr1235 - 25.09.2010

esse meu nao ta dando vira flood de /an

pawn Code:
new addtimer = 60000;
pawn Code:
if(strcmp(cmd, "/anuncio", true) == 0 || strcmp(cmd, "/an", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(gPlayerLogged[playerid] == 0)
            {
                SendClientMessage(playerid, COLOR_GREY, "   Vocк precisa se logar primeiro !");
                return 1;
            }
            if(PlayerInfo[playerid][pLevel] < 2)
            {
                SendClientMessage(playerid, COLOR_GREY, "   Vocк precisa ter nнvel 2 para usar essa funзгo !");
                return 1;
            }
            GetPlayerName(playerid, sendername, sizeof(sendername));
            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: (/an)uncio [texto]");
                return 1;
            }

            if ((!adds) && (PlayerInfo[playerid][pAdmin] < 1))
            {
                format(string, sizeof(string), "   Por favor, tente novamente mais tarde, espere %d segundos entre os anъncios !",  (addtimer/1000));
                SendClientMessage(playerid, COLOR_GRAD2, string);
                return 1;

            }
            new payout = idx * 5;
            if(GetPlayerMoney(playerid) < payout)
            {
                format(string, sizeof(string), "* Vocк usou %d caracteres que custam $%d, vocк nгo tem dinheiro suficiente.", offset, payout);
                SendClientMessage(playerid, COLOR_WHITE, string);
                return 1;
            }
            GivePlayerMoney(playerid, - payout);
            SBizzInfo[7][sbTill] += payout;
            ExtortionSBiz(7, payout);
            format(string, sizeof(string), "Anъncio: %s, Contato: %s Tel: %d",result, sendername, PlayerInfo[playerid][pPnumber]);
            OOCNews(TEAM_GROVE_COLOR,string);
            format(string, sizeof(string), "~r~Pagou $%d~n~~w~O Anъncio contйm: %d caracteres", payout, idx);
            GameTextForPlayer(playerid, string, 5000, 1);
            if (PlayerInfo[playerid][pAdmin] < 1){SetTimer("AddsOn", addtimer, 0);adds = 0;}
        }
        return 1;
    }



Re: [ajuda] como colocar tempo entre os /an - ipsBruno - 26.09.2010

pawn Code:
if(strcmp(cmd, "/anuncio", true) == 0 || strcmp(cmd, "/an", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(gPlayerLogged[playerid] == 0)
            {
                SendClientMessage(playerid, COLOR_GREY, "   Vocк precisa se logar primeiro !");
                return 1;
            }
            if(PlayerInfo[playerid][pLevel] < 2)
            {
                SendClientMessage(playerid, COLOR_GREY, "   Vocк precisa ter nнvel 2 para usar essa funзгo !");
                return 1;
            }
            GetPlayerName(playerid, sendername, sizeof(sendername));
            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: (/an)uncio [texto]");
                return 1;
            }

            if ((!adds) && (PlayerInfo[playerid][pAdmin] < 1))
            {
                format(string, sizeof(string), "   Por favor, tente novamente mais tarde, espere %d segundos entre os anъncios !",  (addtimer/1000));
                SendClientMessage(playerid, COLOR_GRAD2, string);
                return 1;

            }
            new payout = idx * 5;
            if(GetPlayerMoney(playerid) < payout)
            {
                format(string, sizeof(string), "* Vocк usou %d caracteres que custam $%d, vocк nгo tem dinheiro suficiente.", offset, payout);
                SendClientMessage(playerid, COLOR_WHITE, string);
                return 1;
            }
            GivePlayerMoney(playerid, - payout);
            SBizzInfo[7][sbTill] += payout;
            ExtortionSBiz(7, payout);
            format(string, sizeof(string), "Anъncio: %s, Contato: %s Tel: %d",result, sendername, PlayerInfo[playerid][pPnumber]);
            OOCNews(TEAM_GROVE_COLOR,string);
            format(string, sizeof(string), "~r~Pagou $%d~n~~w~O Anъncio contйm: %d caracteres", payout, idx);
            GameTextForPlayer(playerid, string, 5000, 1);
            if (PlayerInfo[playerid][pAdmin] < 1){SetTimer("AddsOn", 60000, 0);adds = 0;}
        }
        return 1;
    }



Re: [ajuda] como colocar tempo entre os /an - lucas_mdr1235 - 26.09.2010

nao deu ainda ta com flood no /an


Re: [ajuda] como colocar tempo entre os /an - ipsBruno - 26.09.2010

@Lucas:
Explica de forma melhor para entendermos.


Respuesta: [ajuda] como colocar tempo entre os /an - Lipepva - 26.09.2010

Topo:
pawn Code:
new AnuncioFeito
pawn Code:
if(strcmp(cmd, "/anuncio", true) == 0 || strcmp(cmd, "/an", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(gPlayerLogged[playerid] == 0)
            {
                SendClientMessage(playerid, COLOR_GREY, "   Vocк precisa se logar primeiro !");
                return 1;
            }
            if(PlayerInfo[playerid][pLevel] < 2)
            {
                SendClientMessage(playerid, COLOR_GREY, "   Vocк precisa ter nнvel 2 para usar essa funзгo !");
                return 1;
            }
            GetPlayerName(playerid, sendername, sizeof(sendername));
            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: (/an)uncio [texto]");
                return 1;
            }

            if ((!adds) && (PlayerInfo[playerid][pAdmin] < 1))
            {
                format(string, sizeof(string), "   Por favor, tente novamente mais tarde, espere %d segundos entre os anъncios !",  (addtimer/1000));
                SendClientMessage(playerid, COLOR_GRAD2, string);
                return 1;

            }
            new payout = idx * 5;
            if(GetPlayerMoney(playerid) < payout)
            {
                format(string, sizeof(string), "* Vocк usou %d caracteres que custam $%d, vocк nгo tem dinheiro suficiente.", offset, payout);
                SendClientMessage(playerid, COLOR_WHITE, string);
                return 1;
            }
        if(AnuncioFeito == 0)
        {
            GivePlayerMoney(playerid, - payout);
            SBizzInfo[7][sbTill] += payout;
            ExtortionSBiz(7, payout);
            format(string, sizeof(string), "Anъncio: %s, Contato: %s Tel: %d",result, sendername, PlayerInfo[playerid][pPnumber]);
            OOCNews(TEAM_GROVE_COLOR,string);
            format(string, sizeof(string), "~r~Pagou $%d~n~~w~O Anъncio contйm: %d caracteres", payout, idx);
            GameTextForPlayer(playerid, string, 5000, 1);
            AnuncioFeito = 1;
            SetTimerEx("ProximoAnuncio",1000*60,true,"i",playerid);
        }
        else
        {
            SendClientMessage(playerid, 0xE4E4E4AA, "- Espere alguns segundos para dar um anuncio.");
        }        
        if (PlayerInfo[playerid][pAdmin] < 1){SetTimer("AddsOn", 60000, 0);adds = 0;}
        }
        return 1;
    }
Final do GM
pawn Code:
forward ProximoAnuncio(playerid);
public ProximoAnuncio(playerid)
{
AnuncioFeito = 0;
return 1;
}
Nгo tenho thug entгo nem testei e fiz o cod aqui mesmo vк aew se pega.


Re: [ajuda] como colocar tempo entre os /an - lucas_mdr1235 - 26.09.2010

resolvido
do jeito q vc falo sem nenhum erro Lipepva
vlw obrigado pela ajuda