[HELP] OnPlayerDeath
#1

Hello,
Everytime i die in my server it makes the player stand (so in that case i can run) in 4 seconds
after 4 seconds the player is dead. How can i avoid the player standing everytime he dies?

code OnPlayerDeath

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    new str[128];
    GameTextForPlayer(playerid, "~r~PWNED!", 2500, 4);
    SendDeathMessage(killerid, playerid, reason);
    pData[playerid][Deaths]++; pData[playerid][Jetpack] = 0; pData[playerid][Killstreak] = 0;
    pData[killerid][Killstreak]++;
    if(gPlayerUsingLoopingAnim[playerid])
    {
        gPlayerUsingLoopingAnim[playerid] = 0;
    }
    if(IsBeingSpeced[playerid] == 1)
    {
        foreach(Player,i)
        {
            if(spectatorid[i] == playerid)
            {
                TogglePlayerSpectating(i, false);
                format(str, sizeof(str), "*** Your spectating to %s(%d) is ended, Reason: Player Death ***", GetpName(playerid), playerid);
                SendClientMessage(i, COLOR_RED, str);
                TextDrawHideForPlayer(i, SpecP[i]);
            }
        }
    }
    if(pData[killerid][DM])
    {
        if(GetPVarInt(playerid, "Headshotted") == 1)
        {
            SetPVarInt(playerid, "Headshotted", 0);
            GameTextForPlayer(playerid, "~r~Headshot", 3000, 3);
            GameTextForPlayer(killerid, "~g~Headshot", 3000, 3);
        }
        switch(pData[killerid][Killstreak])
        {
            case 3:
            {
                foreach(Player, i)
                {
                    format(str, sizeof(str), "[SPREE]: %s(%d) is on Newbie Spree!", GetpName(killerid), killerid);
                    if(pData[i][DM]) SendClientMessage(i, COLOR_ORANGE, str);
                    SendClientMessage(killerid, COLOR_YELLOW, "[SPREE]: You are in Newbie Spree!");
                }
            }
            case 6:
            {
                foreach(Player, i)
                {
                    format(str, sizeof(str), "[SPREE]: %s(%d) is on Killer Spree", GetpName(killerid), killerid);
                    if(pData[i][DM]) SendClientMessage(i, COLOR_ORANGE, str);
                    SendClientMessage(killerid, COLOR_YELLOW, "[SPREE]: You are in Killer Spree!");
                }
            }
            case 9:
            {
                foreach(Player, i)
                {
                    format(str, sizeof(str), "[SPREE]: %s(%d) is on Pro Shooter Spree", GetpName(killerid), killerid);
                    if(pData[i][DM]) SendClientMessage(i, COLOR_ORANGE, str);
                    format(str, sizeof(str), "[SPREE]: %s(%d) has recieved some additional reward (Armour + Health)", GetpName(killerid), killerid);
                    if(pData[i][DM]) SendClientMessage(i, COLOR_ORANGE, str);
                    SendClientMessage(killerid, COLOR_YELLOW, "[SPREE]: You are in Pro Shooter Spree!");
                    SendClientMessage(killerid, COLOR_LIGHTGREEN, "[SPREE]: You have recieved some additional reward (Armour + Health)");
                    SetPlayerArmour(killerid, 32.0);
                    SetPlayerHealth(killerid, 40.0);
                }
            }
            case 12:
            {
                foreach(Player, i)
                {
                    format(str, sizeof(str), "[SPREE]: %s(%d) is on Master Killing Spree", GetpName(killerid), killerid);
                    if(pData[i][DM]) SendClientMessage(i, COLOR_ORANGE, str);
                    SendClientMessage(killerid, COLOR_YELLOW, "[SPREE]: You are in Master Killing Spree!");
                }
            }
            case 15:
            {
                foreach(Player, i)
                {
                    format(str, sizeof(str), "[SPREE]: %s(%d) is on Ranking Spree", GetpName(killerid), killerid);
                    if(pData[i][DM]) SendClientMessage(i, COLOR_ORANGE, str);
                    SendClientMessage(killerid, COLOR_YELLOW, "[SPREE]: You are in Ranking Spree!");
                }
            }
            case 18:
            {
                foreach(Player, i)
                {
                    format(str, sizeof(str), "[SPREE]: %s(%d) is turning to ThE BoSs Spree", GetpName(killerid), killerid);
                    if(pData[i][DM]) SendClientMessage(i, COLOR_ORANGE, str);
                    format(str, sizeof(str), "[SPREE]: %s(%d) has recieved some additional reward (3 ammo of Grenade + Armour + Health)", GetpName(killerid), killerid);
                    if(pData[i][DM]) SendClientMessage(i, COLOR_ORANGE, str);
                    SendClientMessage(killerid, COLOR_YELLOW, "[SPREE]: You are turning to ThE BoSs Spree!");
                    SendClientMessage(killerid, COLOR_LIGHTGREEN, "[SPREE]: You have recieved some additional reward (3 ammo of Grenade + Armour + Health)");
                    SetPlayerArmour(killerid, 50.0);
                    SetPlayerHealth(killerid, 40.0);
                    GivePlayerWeapon(killerid, 16, 3);
                }
            }
            case 21:
            {
                foreach(Player, i)
                {
                    format(str, sizeof(str), "[SPREE]: %s(%d) is on Undestructable Spree", GetpName(killerid), killerid);
                    if(pData[i][DM]) SendClientMessage(i, COLOR_ORANGE, str);
                    SendClientMessage(killerid, COLOR_YELLOW, "[SPREE]: You are in Undestructable Spree");
                }
            }
            case 24:
            {
                foreach(Player, i)
                {
                    format(str, sizeof(str), "[SPREE]: %s(%d) is turning to Unreveal Spree Rank", GetpName(killerid), killerid);
                    if(pData[i][DM]) SendClientMessage(i, COLOR_ORANGE, str);
                    format(str, sizeof(str), "[SPREE]: %s(%d) has recieved some additional reward (3 ammo of RPG + Armour + Health)", GetpName(killerid), killerid);
                    if(pData[i][DM]) SendClientMessage(i, COLOR_ORANGE, str);
                    SendClientMessage(killerid, COLOR_YELLOW, "[SPREE]: You are turning to Unreveal Spree Rank");
                    SendClientMessage(killerid, COLOR_LIGHTGREEN, "[SPREE]: You have recieved some additional reward (3 ammo of RPG + Armour + Health)");
                    SetPlayerArmour(killerid, 30.0);
                    SetPlayerHealth(killerid, 50.0);
                    GivePlayerWeapon(killerid, 35, 3);
                }
            }
            case 27:
            {
                foreach(Player, i)
                {
                    format(str, sizeof(str), "[SPREE]: %s(%d) has reach the Maxium Spree Rank", GetpName(killerid), killerid);
                    if(pData[i][DM]) SendClientMessage(i, COLOR_ORANGE, str);
                    SendClientMessage(killerid, COLOR_YELLOW, "[SPREE]: You reach the Maxium Spree Rank");
                    SendClientMessage(killerid, -1, "Attention: "red"There is no more Spree Rank");
                }
            }
        }
        return 1;
    }
    if(killerid != INVALID_PLAYER_ID)
    {
        if(GetPVarInt(playerid, "Headshotted") == 1)
        {
            SetPVarInt(playerid, "Headshotted", 0);
            GameTextForPlayer(playerid, "~r~Headshot", 3000, 3);
            GameTextForPlayer(killerid, "~g~Headshot", 3000, 3);
        }
        SetPlayerScore(killerid, GetPlayerScore(killerid) + 1);
        GivePlayerCash(killerid, 5000);
        pData[killerid][Kills]++;
    }
    return 1;
}
Reply
#2

pawn Код:
if(gPlayerUsingLoopingAnim[playerid])    
{        
      gPlayerUsingLoopingAnim[playerid] = 0;  
 }
whats this used for here
Reply
#3

that is animation system that i put it inside my gamemode credits to kyeman (i think)
Reply
#4

BUMP
Reply
#5

Maybe respawn the player? Or set his health to 0/-1?
Reply
#6

No your method didn't work zombieking it still keeps the bug
Reply
#7

Sorry for double posting but
i found out that the problem is not coming from OnPlayerDeath
its coming from somewhere
Reply
#8

Thanks for all of your help, but its not totally bug, it clears the animation it came from the include fixes. i remove the OnPlayerDeath fix code in fixes it all works fine now

Solved
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)