[Ajuda]Sistema de recuperar vida
#1

Galera, estou tentando aprender a mecher com SetTimer, ja fiz um pedido antes de blindagem, mas aquele utilizava comando, entгo eu n posso usar as mesmas coisas que usei naquele, nesse daqui. Por isso vim pedir novamente ajuda ;X

Estou querendo por um sistema de recuperar vida do player, se o player ficar parado a cada 30 segundos, recuperar a vida dele, mas n й sу isso.. Se ele ficar parado uns 15segundos por ai, dai fazer a animaзгo para ele sentar.

essa anime aqui
pawn Код:
ApplyAnimation(playerid, "BEACH", "ParkSit_M_loop", 4.0, 1, 0, 0, 0, 0);
Bom galera, desculpa postar mais uma vez sobre esse assunto de timers aqui, mas й que n aprendi mto bem ainda.. vlw
Reply
#2

pawn Код:
forward RecHP(playerid);

public RecHP(playerid)
{
    SetPlayerHealth(playerid, 100);
    return 1;
}

//No Comando Ou Outro Local do Mode

SetTimerEx("RecHP", 30000, false, "i", playerid);
Era Isso que procurava ?
Reply
#3

Sim, praticamente isso dai, mas esse seu ele recupera hp a cada 30segundos, estou a procura de um q recupere hp somente se o player ficar sem se mexer por 30segundos..

e outra duvida:
pawn Код:
//No Comando Ou Outro Local do Mode

SetTimerEx("RecHP", 30000, false, "i", playerid);
й isso q eu n sei , aonde tem q por? pq n vou usar comando
Reply
#4

Teria que ser entгo apartir do OnPlayerSpawn. , mas vou estudar isto para funcionar apenas quando ficar parado =)
Reply
#5

Aqui estб:
pawn Код:
#include <a_samp>

new Timer;
new bool:Descansando[MAX_PLAYERS];

public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print("         FS by CidadeNovaRP ¬¬");
    print("--------------------------------------\n");
    return 1;
}

public OnPlayerConnect(playerid)
{
    Pos(playerid);
    return 1;
}

forward Pos(playerid);
public Pos(playerid)
{
    new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, x, y, z);
    SetPVarFloat(playerid, "X", x);
    SetPVarFloat(playerid, "Y", y);
    SetPVarFloat(playerid, "Z", z);
    SetTimerEx("HP", 30000, false, "i", playerid);
    return 1;
}

forward HP(playerid);
public HP(playerid)
{
    new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, x, y, z);
    if(GetPVarFloat(playerid,"X") == x  && GetPVarFloat(playerid,"Y") == y  && GetPVarFloat(playerid,"Z") == z)
    {
        if(Descansando[playerid] == false)
        {
            Descansando[playerid] = true;
            TogglePlayerControllable(playerid, 0);
            ApplyAnimation(playerid, "BEACH", "ParkSit_M_loop", 4.0, 1, 0, 0, 0, 0);
            Timer = SetTimerEx("DarHP", 1000, true, "i", playerid);
            SendClientMessage(playerid, -1, "~~~> Aperte 'F'ou 'Enter' para Levantar-se <~~~");
        }
    }
    else
    {
        Pos(playerid);
    }
    return 1;
}

forward DarHP(playerid);
public DarHP(playerid)
{
    if(Descansando[playerid] == true)
    {
        new Float:NewHealth;
        GetPlayerHealth(playerid, NewHealth);
        SetPlayerHealth(playerid, NewHealth+1);
    }
    return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys == 16 && GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
    {
        if(Descansando[playerid] == true)
        {
            Descansando[playerid] = false;
            TogglePlayerControllable(playerid, 1);
            ClearAnimations(playerid);
            KillTimer(Timer);
            Pos(playerid);
        }
    }
    return 1;
}
Reply
#6

vou testar, vlw ae
Reply
#7

Quote:
Originally Posted by Felipe_Wesker
Посмотреть сообщение
vou testar, vlw ae
Disponha
Reply
#8

Cara funcionou de boa! Valeu cara.. vc й novo no server mas jб й mto inteligente, parabens cara!! Valeu mto.
sу n dou mais rep pq n da pra dar mais!
Reply
#9

Quote:
Originally Posted by Felipe_Wesker
Посмотреть сообщение
Cara funcionou de boa! Valeu cara.. vc й novo no server mas jб й mto inteligente, parabens cara!! Valeu mto.
sу n dou mais rep pq n da pra dar mais!
Valeu *-* Em outro tуpico vocк da o REP(se quiser й claro) '-'
Boa sorte em seu Servidor
Reply
#10

Certo cara, valeu mesmo.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)