SA-MP Forums Archive
hi i want to make a water death! - 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)
+--- Thread: hi i want to make a water death! (/showthread.php?tid=279864)



hi i want to make a water death! - [GTA]AmericanGangster - 29.08.2011

Hello guyz i want to make a water death.When someone fell in water he will die!and then he will spectate the first player!


Re: hi i want to make a water death! - Johndaonee - 29.08.2011

Theres a function called IsPlayerInWater ( Dunno who made it ) you should take a look at it, it might help you.


Re: hi i want to make a water death! - Farsek - 29.08.2011

pawn Код:
public OnPlayerUpdate(playerid)
{
    if(GetPlayerAnimationIndex(playerid))
    {
        new animlib[32];
        new animname[32];
        GetAnimationName(GetPlayerAnimationIndex(playerid),animlib,32,animname,32);
        if(strcmp(animlib,"SWIM",true)==0)
        {
        new Float:HP;GetPlayerHealth(playerid,HP);
        if(HP>10.0)
        {
                SetPlayerHealth(playerid,0.0);
        }
        }
    }
    return 1;
}



Re: hi i want to make a water death! - Davz*|*Criss - 29.08.2011

Quote:
Originally Posted by Farsek
Посмотреть сообщение
pawn Код:
public OnPlayerUpdate(playerid)
{
    if(GetPlayerAnimationIndex(playerid))
    {
        new animlib[32];
        new animname[32];
        GetAnimationName(GetPlayerAnimationIndex(playerid),animlib,32,animname,32);
        if(strcmp(animlib,"SWIM",true)==0)
        {
        new Float:HP;GetPlayerHealth(playerid,HP);
        if(HP>10.0)
        {
                SetPlayerHealth(playerid,0.0);
        }
        }
    }
    return 1;
}
Great code.


Re: hi i want to make a water death! - [GTA]AmericanGangster - 29.08.2011

thanks guyz i will test it!


Re: hi i want to make a water death! - [GTA]AmericanGangster - 29.08.2011

i got 1 error:
pawn Код:
TakeshisCastle[Minigames].pwn(463) : error 021: symbol already defined: "OnPlayerUpdate"



Re: hi i want to make a water death! - Farsek - 29.08.2011

....
Press ctrl+f, type "OnPlayerUpdate"(maybe you'll be redirected to 'my' OnPlayerUpdate but press "next") and put after:
public OnPlayerUpdate(playerid)
{

this:
pawn Код:
if(GetPlayerAnimationIndex(playerid))
    {
        new animlib[32];
        new animname[32];
        GetAnimationName(GetPlayerAnimationIndex(playerid),animlib,32,animname,32);
        if(strcmp(animlib,"SWIM",true)==0)
        {
        new Float:HP;GetPlayerHealth(playerid,HP);
        if(HP>10.0)
        {
                SetPlayerHealth(playerid,0.0);
        }
        }
    }
Compile,and when it's over,press 'F1' and start to read some stuff about pawn


Re: hi i want to make a water death! - [GTA]AmericanGangster - 29.08.2011

works!ty