[Ajuda] Loop
#8

UM BOM EXEMPLO DE COMO USAR ISSO IN-GAME:


PHP код:
/*--------------------------------------------------------------------------------
                        no inicio do gamemode */
#include <a_samp>
#include <ZCMD>
#include <SSCANF>
//------------------------------------------------------------------------------
new
    
CriarTime[MAX_PLAYERS],
    
TimeEmAndamento[MAX_PLAYERS]
;
CMD:loopplayer(playeridparams[])
{
    if(
TimeEmAndamento[playerid] == 1)
    {
        
KillTimer(CriarTime[playerid]);
        
TimeEmAndamento[playerid] = 0;
        
SendClientMessage(playerid, -1"Funзгo cancelada(finalizada).");
        return 
1;
    }
    new
        
FUNCOES[30],
        
ID,
        
PARAMETRO_1,
        
TIMER,
        
REPEAT
    
;
    if(
sscanf(params"sdddd",FUNCOESIDPARAMETRO_1TIMERREPEAT))
        return 
SendClientMessage(playerid, -1"Use: /loop [nome-da-public] [player] [parвmetro1] [segundos] [repetiзгo 0 = off | 1 = on]");
        
    if(
REPEAT || REPEAT 0)
        return 
SendClientMessage(playerid, -1"[ repetiзгo > 0 = off/ 1 = on ]");
    new
        
nomeplayer[25],
        
nomefuncao[50],
        
corpomsg[128],
        
DefinirDepeticao[2][13] = {"sem repetзгo""com repetзгo"}
    ;
    
GetPlayerName(IDnomeplayer25)
    ;
    
format(corpomsgsizeof corpomsg,"Voce usou %s %d em %s, daqui a % segundos %s"nomefuncaoPARAMETRO_1nomeplayerTIMERDefinirDepeticao[REPEAT]);
    
SendClientMessage(playerid, -1corpomsg);
    
    
format(nomefuncaosizeof nomefuncao"%s"FUNCOES);
    
CriarTime[playerid] = SetTimerEx(nomefuncaoTIMER*1000REPEAT"id"IDPARAMETRO_1);
    
TimeEmAndamento[playerid] = 1;
    return 
true;

Comando: /loopplayer SetPlayerMoney 0 500 2 1


/loopplayer = comando
SetPlayerMoney = uma funзгo que seta dinheiro
0 = й o id do player a ser executada a funзгo
2 = segundos
1 = repetiзгo ativada

Ou seja, o jogador 0 ira receber 500 dуlares a cada 2 segundos.
Para cancelar isso basta digita somente o '/looplayer'
Reply


Messages In This Thread
Loop - by Wellington1999 - 31.07.2017, 23:10
Re: Loop - by [BOPE]Seu._.Madruga - 01.08.2017, 00:00
Re: Loop - by GuilhermeNunes - 01.08.2017, 00:44
Re: Loop - by Jonorusc - 01.08.2017, 14:32
Re: Loop - by XandyMello - 01.08.2017, 20:18
Re: Loop - by [BOPE]Seu._.Madruga - 02.08.2017, 16:47
Re: Loop - by RodrigoMSR - 02.08.2017, 20:39
Re: Loop - by NandoCrazzy - 02.08.2017, 22:18

Forum Jump:


Users browsing this thread: 3 Guest(s)