[Ajuda] Reduзгo de hp por tempo
#1

Olб, estou querendo criar um zcmd que pуs usar o life seja reduzido de 1 por 1 com tempo de 2 seg Cmd:reduzirlife e um para parar a reduзгo CMD:Preducao
Reply
#2

Acho que dб certo, nгo testei:
pawn Код:
new
    tempohp,
    Float:VidaAll[MAX_PLAYERS]
;


CMD:reduzirlife(playerid)
{
    if(tempohp)
        return SendClientMessage(playerid, -1, " Jб usaram esse comando. ");
    tempohp = SetTimer("ReduzirHP", 2000, true);
    SendClientMessage(playerid, -1, " A cada 2 segundos a vida irб abaixar.");
    return 1;
}

CMD:reducao(playerid)
{
    if(!tempohp)
        return SendClientMessage(playerid, -1, " Ainda nгo ativaram o reduзгo de vida. ");
    KillTimer(tempohp);
    SendClientMessage(playerid, -1, " Reduzir vida automaticamente, desativado.");
    return 1;
}

forward ReduzirHP();
public ReduzirHP()
{
    for(new r = 0; r<MAX_PLAYERS; r++)
    {
        if(IsPlayerConnected(r))
        {
            GetPlayerHealth(r, VidaAll[r]);
            SetPlayerHealth(r, VidaAll[r]-1);
        }
    }
    return 1;
}
Reply
#3

Usa SetTimerEx .-. .-.
Reply
#4

Quote:
Originally Posted by JonathanFeitosa
Посмотреть сообщение
Usa SetTimerEx .-. .-.
SetTimerEx seria sу pra um destinбrio, caso nгo usasse loop.

Mas, acredito que ele pediu para todos '-'
Reply
#5

Quote:
Originally Posted by @Riichard
Посмотреть сообщение
SetTimerEx seria sу pra um destinбrio, caso nгo usasse loop.

Mas, acredito que ele pediu para todos '-'
Ele nem informou xD E seria uma bela de uma pandemia e idiotice '-'
Reply
#6

Quote:
Originally Posted by @Riichard
Посмотреть сообщение
Acho que dб certo, nгo testei:
pawn Код:
new
    tempohp,
    Float:VidaAll[MAX_PLAYERS]
;


CMD:reduzirlife(playerid)
{
    if(tempohp)
        return SendClientMessage(playerid, -1, " Jб usaram esse comando. ");
    tempohp = SetTimer("ReduzirHP", 2000, true);
    SendClientMessage(playerid, -1, " A cada 2 segundos a vida irб abaixar.");
    return 1;
}

CMD:reducao(playerid)
{
    if(!tempohp)
        return SendClientMessage(playerid, -1, " Ainda nгo ativaram o reduзгo de vida. ");
    KillTimer(tempohp);
    SendClientMessage(playerid, -1, " Reduzir vida automaticamente, desativado.");
    return 1;
}

forward ReduzirHP();
public ReduzirHP()
{
    for(new r = 0; r<MAX_PLAYERS; r++)
    {
        if(IsPlayerConnected(r))
        {
            GetPlayerHealth(r, VidaAll[r]);
            SetPlayerHealth(r, VidaAll[r]-1);
        }
    }
    return 1;
}
Vlw
Reply
#7

Quote:
Originally Posted by merloch
Посмотреть сообщение
para setar apenas a pessoa que usou como seria?
Reply
#8

ficaria assim para uma pessoa so
PHP код:
new
    
tempohp[MAX_PLAYERS],
    
Float:VidaAll[MAX_PLAYERS]
;


CMD:reduzirlife(playerid)
{
    if(
tempohp[playerid])
        return 
SendClientMessage(playerid, -1" Jб usaram esse comando. ");
    
tempohp[playerid] = SetTimerEx("ReduzirHP"2000true,"i",playerid);
    
SendClientMessage(playerid, -1" A cada 2 segundos a vida irб abaixar.");
    return 
1;
}

CMD:reducao(playerid)
{
    if(!
tempohp[playerid])
        return 
SendClientMessage(playerid, -1" Ainda nгo ativaram o reduзгo de vida. ");
    
KillTimer(tempohp[playerid]);
    
SendClientMessage(playerid, -1" Reduzir vida automaticamente, desativado.");
    return 
1;
}

forward ReduzirHP(playerid);
public 
ReduzirHP(playerid)
{
    
GetPlayerHealth(playeridVidaAll[playerid]);
    
SetPlayerHealth(playeridVidaAll[playerid]-1);
    return 
1;

Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)