Death system doesn't work properly.
#1

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

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

I'm afraid it does the same thing without it.
Reply
#4

Give the weapons on spawn?
Reply
#5

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?
Reply
#6

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


Forum Jump:


Users browsing this thread: 1 Guest(s)