Drugs
#4

Quote:
Originally Posted by Beginnercoder
Посмотреть сообщение
The thing is, I'm not so sure on how to do this
pawn Код:
new checkhealth;

forward WhenUsingDrugs(playerid);
public WhenUsingDrugs(playerid)
{
    new Float:health;
    GetPlayerHealth(playerid,health);
    if(health < 100)
    {
        SetPlayerHealth(playerid, health++);
    }
    else
    {
        KillTimer(checkhealth);
        SendClientMessage(playerid, -1, "You have now full health.");

    }
    return 1;
}

CMD:usedrugs(playerid, params[])
{
    new Float:health;
    GetPlayerHealth(playerid, health);
    if(health == 100)
    {
        SendClientMessage(playerid, -1, "You have full health, what is a need of drug then?");
    }
    else
    {
        SendClientMessage(playerid, -1, "You are now using drugs, your health will increase per second.");
        checkhealth = SetTimer("WhenUsingDrugs", 1000, true); // Set a timer of 1000 miliseconds (1 second)
    }
}
Really, I have no idea if this works. Give a try and anyone here if think it's wrong please feel free to edit and help him, i am on phone so i am not sure and write further .

-FalconX
Reply


Messages In This Thread
Drugs - by Beginnercoder - 14.04.2012, 19:41
Re: Drugs - by Shetch - 14.04.2012, 20:19
Re: Drugs - by Beginnercoder - 14.04.2012, 21:05
Re: Drugs - by FalconX - 14.04.2012, 22:26
Re: Drugs - by Beginnercoder - 14.04.2012, 23:06
Re: Drugs - by FalconX - 14.04.2012, 23:14
Re: Drugs - by Beginnercoder - 15.04.2012, 09:37
Re: Drugs - by captainjohn - 15.04.2012, 16:57

Forum Jump:


Users browsing this thread: 1 Guest(s)