SA-MP Forums Archive
MAp - 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: MAp (/showthread.php?tid=615625)



MAp - Loinal - 24.08.2016

Hello guys i made the derby system but when the player get in the water he didn't die why?


Re: MAp - M8 - 24.08.2016

If you don't show any code, no one can help you.


Re: MAp - Crayder - 25.08.2016

Dying during water contact is not a native GTA or SA-MP feature.


Re: MAp - Threshold - 25.08.2016

There are multiple ways you can approach this.

OnVehicleDeath - Gets called when a vehicle is submerged in water or when a vehicle explodes.
GetPlayerAnimationIndex + GetAnimationName - You can check a player's animation library/name to check if they have a swimming animation applied to them.
GetPlayerPos - Check a player's Z coordinate to see if they are physically underneath the lowest platform, to determine if they have 'fallen off'. You should allow a reasonable amount to prevent any false positives.
CreateDynamicArea - Create a dynamic area using Incognito's Streamer plugin or any other applicable plugin, and use that area to determine if the player is still within the playing field or not.

Each alternative has it's pros and cons, but with enough attention to detail, you can create a flawless system of your own.


Re: MAp - TomRedlake - 25.08.2016

pawn Код:
stock IsPlayerInWater(playerid)
{
    new animlib[32],tmp[32];
    GetAnimationName(GetPlayerAnimationIndex(playerid),animlib,32,tmp,32);
    if(!strcmp(animlib, "SWIM") && !IsPlayerInAnyVehicle(playerid) ) return true;
    return false;
}
And put this on player update:

pawn Код:
if(IsPlayerInWater(playerid))
        {
            SetPlayerHealth(playerid,0.0);
        }