Interior & VW is fucked up.
#1

Hey, i have really big problem. I have Brutally Wounded system (BW), and when someone dies, he is placed in same place and he can use /acceptdeath to go to the hospital. But when someone dies in interior, he falls from the sky, maybe because he spawns at interior 0 and wrong VW. How to fix that?

Some of my code:

pawn Код:
new Float:DeathPosX                 [MAX_PLAYERS];
new Float:DeathPosY                 [MAX_PLAYERS];
new Float:DeathPosZ                 [MAX_PLAYERS];
pawn Код:
public OnPlayerSpawn(playerid)
{
    IsAfterLifing[playerid] = 0;
    if (IsDead[playerid] == 1)
    {
        SetPlayerPos(playerid,DeathPosX[playerid],DeathPosY[playerid],DeathPosZ[playerid]);
        SetPlayerCameraPos(playerid,DeathPosX[playerid],DeathPosY[playerid],DeathPosZ[playerid]+5);
        SetPlayerCameraLookAt(playerid,DeathPosX[playerid],DeathPosY[playerid],DeathPosZ[playerid]);
        TogglePlayerControllable(playerid,false);
        ApplyAnimation(playerid,"PARACHUTE","FALL_skyDive_DIE", 4.0, 0, 0, 0, 1, 0);
        SetTimerEx("AutoDeath",AUTODEATH_SECONDS * 1000,false,"i",playerid);
        SCM(playerid,WHITE,"You are now laying death. You are bleeding to death.");
        SCM(playerid,WHITE,"You can type /acceptdeath, if no medics are available.");
        SCM(playerid,WHITE,"It will take you to hospital.");
        return 1;
    }
    return 1;
}
Reply
#2

You must save his interior when he dies, and set it again.
Reply
#3

I know, but how to do that?
Reply
#4

It should be something as this:
pawn Код:
new
    gLastVW                 [MAX_PLAYERS],
    gLastInt                [MAX_PLAYERS],
    Float:gLastPos          [MAX_PLAYERS][3],
    bool:gDead              [MAX_PLAYERS]
;

public OnPlayerDeath(playerid) {
    if (!gDead[playerid]) {
        gDead[playerid] = true;
        gLastInt[playerid] = GetPlayerInterior(playerid);
        gLastVW[playerid] = GetPlayerVirtualWorld(playerid);
        GetPlayerPos(playerid, gLastPos[playerid][0], gLastPos[playerid][1], gLastPos[playerid][2]);
    }
    return 1;
}
public OnPlayerSpawn(playerid) {
    if (gDead[playerid]) {
   
        SetPlayerInterior(playerid, gLastInt[playerid]);
        SetPlayerVirtualWorld(playerid, gLastVW[playerid]);
        SetPlayerPos(playerid, gLastPos[playerid][0], gLastPos[playerid][1], gLastPos[playerid][2]);

        /* Animations, etc. there */
       
        SendClientMessage(playerid, -1, "Use /acceptdeath to rest in peace.");
    } else {
        /* He accepted the death, send him to the hospital or somewhere. */
    }
    return 1;
}

COMMAND:acceptdeath(playerid, params[]) {
    if (!gDead[playerid])
        return SendClientMessage(playerid, -1, "You're not dead my man!!!");
   
    gDead[playerid] = false;
    SetPlayerHealth(playerid, 0.0);
    SendClientMessage(playerid, "You just accepted the death.");
    return 1;
}

/* NOTE: if paramedics manage to save him, just set gDead to false */
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)