SA-MP Forums Archive
Death system doesn't work properly. - 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: Death system doesn't work properly. (/showthread.php?tid=505853)



Death system doesn't work properly. - Dokins - 10.04.2014

Hi there!

I've tried debugging this, I'm not entirely sure why it doesn't do as I ask.

For some reason OnPlayerDeath is removing my weapons as well.

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]);
    printf("Set the position");

    GivePlayerWeaponEx(playerid);
    printf("Gave Weapons");
   
   
    ApplyAnimation(playerid, "KNIFE", "KILL_Knife_Ped_Die", 4.1, 0, 1, 1, 0, 0, 1);
    printf("Animation");
    TogglePlayerControllable(playerid, 0);
    printf("Controllable");
    PlayerDead[playerid] = 1;
    DeathTimer[playerid] = 3;
   
    SetPlayerHealth(playerid, 99999);
   
    DeathLabel[playerid] =  CreateDynamic3DTextLabel("D E A D B O D Y", COLOUR_REALRED, DeathPosX[playerid],DeathPosY[playerid],DeathPosZ[playerid]+0.5, 50.0, playerid, INVALID_VEHICLE_ID, 0, 0, -1, -1, 50.0);
    return 1;
}
Here's my OnPlayerDeath.
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    new Float: x,Float:y,Float:z;
    GetPlayerPos(playerid, x, y, z);
   
    PlayerDeath(playerid, x, y, z, reason);

    //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;
}
It Reaches all of them, but doesn't actually do anything except Set the position and set the health - Nothing else.


Re: Death system doesn't work properly. - RajatPawar - 10.04.2014

The only thing I can see is 'GivePlayerWeaponEx' - post it, please!


Re: Death system doesn't work properly. - Dokins - 10.04.2014

I'm afraid it does the same thing without it.


Re: Death system doesn't work properly. - superrobot48 - 10.04.2014

Give the weapons on spawn?


Re: Death system doesn't work properly. - Konstantinos - 10.04.2014

Quote:
Originally Posted by Dokins
Посмотреть сообщение
I'm afraid it does the same thing without it.
If you don't use GivePlayerWeaponEx, then it won't give the weapons.
If there's something wrong in GivePlayerWeaponEx, then it won't give the weapons.

The problem might be in GivePlayerWeaponEx. By the way, doesn't it apply the animation, freeze the player or create the 3D label at all?


Re: Death system doesn't work properly. - Dokins - 10.04.2014

Quote:

By the way, doesn't it apply the animation, freeze the player or create the 3D label at all?

Not at all. Confusing huh?

I am preloading the anim library, also I removed the weapons temporarily, I do know it works, but to just save any hassle.