SA-MP Forums Archive
Issue with Death System (Very odd.) - 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: Issue with Death System (Very odd.) (/showthread.php?tid=506041)



Issue with Death System (Very odd.) - Dokins - 11.04.2014

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.


Re: Issue with Death System (Very odd.) - SickAttack - 11.04.2014

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



Re: Issue with Death System (Very odd.) - Dokins - 11.04.2014

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

thank you though!


Re: Issue with Death System (Very odd.) - SickAttack - 11.04.2014

Well you can do that.


Re: Issue with Death System (Very odd.) - Dokins - 11.04.2014

Yeah, but it doesn't aha!