Anim Help
#1

How can i make when poeple /pee or use any animation it will be increase health 1/sec. and when player type or didn't use anim it will not increase health
Reply
#2

Add at the top

pawn Код:
forward PeeHealth(playerid), peetimer;
Add at the pee command

pawn Код:
peetimer = SetTimerEx("PeeHealth", 1000, true, "d", playerid);
This must be NOT in the pee command!

pawn Код:
public PeeHealth(playerid)
{
    if(GetPlayerAnimationIndex(playerid))
    {
        new animlib[32];
        new animname[32];
        GetAnimationName(GetPlayerAnimationIndex(playerid), animlib, 32, animname, 32);
        if(animlib == PAULNMAC && animname = Piss_loop)
        {
            new Float:oldhealth;
            GetPlayerHealth(playerid, oldhealth);
            if(oldhealth >= 100) return KillTimer(peetimer);
            SetPlayerHealth(playerid, oldhealth+1);
            return 1;
        }
        else KillTimer(peetimer);
    }
    return 1;
}
If it gives the errors:

PHP код:
undefined symbol "PAULNMAC"
undefined symbol "Piss_loop" 
then make it

pawn Код:
if(animlib == "PAULNMAC" && animname = "Piss_loop")
Reply
#3

Sorry for not making a full post, but won't your function give health till infinity?
Because i don't remember if health function was limited. Someone may delete this post if it is limited till 100 by itself.
Reply
#4

Quote:
Originally Posted by RSX
Посмотреть сообщение
Sorry for not making a full post, but won't your function give health till infinity?
Because i don't remember if health function was limited. Someone may delete this post if it is limited till 100 by itself.
Added something that does check it for you and kills the timer if he has 100 or more
Reply
#5

it's make an error when i compile

expected token: "-string end-", but found "-identifier-"

if(animlib == "PAULNMAC" && animname == "Piss_loop") -------- on this line
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)