#1

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

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

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

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.
Reply
#5

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);
        }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)