SA-MP Forums Archive
Anim Help - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Anim Help (/showthread.php?tid=170826)



Anim Help - xinix000 - 24.08.2010

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


Re: Anim Help - Claude - 24.08.2010

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")



Re: Anim Help - RSX - 24.08.2010

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.


Re: Anim Help - Claude - 24.08.2010

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


Re: Anim Help - xinix000 - 01.10.2010

it's make an error when i compile

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

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