Issue with Death System (Very odd.)
#1

pawn Код:
stock PlayerDeath(playerid, Float: x, Float: y, Float: z, reason)
{
    DeathPosX[playerid] = x;
    DeathPosY[playerid] = y;
    DeathPosZ[playerid] = z;
    SetPlayerPos(playerid, DeathPosX[playerid], DeathPosY[playerid], DeathPosZ[playerid]);
   
    ApplyAnimation(playerid, "KNIFE", "KILL_Knife_Ped_Die", 4.1, 0, 1, 1, 1, 0, 1);

    PlayerDead[playerid] = 1;
    DeathTimer[playerid] = 3;
    CreateDynamic3DTextLabel("DEAD BODY", COLOUR_RED,x,y,z,50.0, playerid, INVALID_VEHICLE_ID, 1, 0, 0, -1, 100.0);

    return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    SetTimerEx("DebugDeath", 800, false, "i", playerid);
   
    new Float: x,Float:y,Float:z;
    GetPlayerPos(playerid, x, y, z);

    PlayerDeath(playerid, x, y, z, reason);
   
    CreateDynamic3DTextLabel("DEAD BODY", COLOUR_RED,x,y,z,50.0, playerid, INVALID_VEHICLE_ID, 1, 0, 0, playerid, 100.0);

    //DropGun(playerid, GetWepIndexFromSQL(GetPlayerWeaponEx(playerid)),GetPlayerAmmo(playerid),x,y,z,GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid));
    if(IsPlayerInAnyVehicle(playerid))
    {
        RemovePlayerFromVehicle(playerid);
        TextDrawHideForPlayer(playerid,speed[playerid]);
        TextDrawHideForPlayer(playerid,fuel[playerid]);
        KillTimer(FuelSysTimer[playerid]);
        KillTimer(SpeedoSysTimer[playerid]);
    }

    //Hospitalized[playerid] = 1;
    //HospitalTime[playerid] = 30;
    //dohospital(playerid);


    return 1;
}

forward DebugDeath(playerid);
public DebugDeath(playerid)
{
    SetPlayerHealth(playerid, 99999);
    //GivePlayerWeaponEx(playerid);
    ApplyAnimation(playerid, "KNIFE", "KILL_Knife_Ped_Die", 4.1, 0, 1, 1, 1, 0, 1);
    return 1;
}

You can see from the code how it works, DEBUGDEATH just adds a timer to do all the stuff that apparently OnPlayerDeath wont. I did it twice to try and force it, nothing. I've done it with just once on All three areas.


It doesn't do the following:

APPLY ANIMATION - Yes I add AnimLibrary on player connecting.
CREATE THE DEATH LABEL - I've tried changing colours etc, I've tried it under all three - No Warnings.



If anyone could let me know why they think, that would be great.
Reply
#2

Tested and works.
pawn Код:
ApplyAnimation(playerid, "KNIFE", "KILL_Knife_Ped_Die", 4.1, 0, 1, 1, 0, 0, 1);
CreateDynamic3DTextLabel("DEAD BODY", COLOR_RED, x, y, z, 40.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, -1, -1, -1, 100.0);
Reply
#3

It's got to attach to a player, that's why playerid is there aha!

thank you though!
Reply
#4

Well you can do that.
Reply
#5

Yeah, but it doesn't aha!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)