SA-MP Forums Archive
GetPlayerInterior returns 0 OnPlayerDeath? - 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: GetPlayerInterior returns 0 OnPlayerDeath? (/showthread.php?tid=381252)



GetPlayerInterior returns 0 OnPlayerDeath? - 2KY - 29.09.2012

I have a death revival system for my roleplay server, which works perfectly. Until the person dies inside of an interior. It resets their interior to 0 rather than the actual interior ID.

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    new
        Float:  myPos [ 4 ],
        int,
        vw;
       
    GetPlayerPos( playerid, myPos [ 0 ], myPos [ 1 ], myPos [ 2 ] );
    GetPlayerFacingAngle( playerid, myPos [ 3 ] );
    int = GetPlayerInterior( playerid );
    vw = GetPlayerVirtualWorld( playerid );
   
    plJustDied [ playerid ] = true;
    plDeathPosition [ playerid ] [ 0 ] = myPos [ 0 ], plDeathPosition [ playerid ] [ 1 ] = myPos [ 1 ],
    plDeathPosition [ playerid ] [ 2 ] = myPos [ 2 ], plDeathPosition [ playerid ] [ 3 ] = myPos [ 3 ];
    plDeathInterior [ playerid ] = int;
    plDeathVirtualWorld [ playerid ] = vw;
    return true;
}



Re: GetPlayerInterior returns 0 OnPlayerDeath? - newbienoob - 29.09.2012

Try this?
pawn Код:
//at the top
int[MAX_PLAYERS];
//OnPlayerDeath
int[playerid] = GetPlayerInterior(playerid);
//Anywhere (maybe OnPlayerSpawn?)
SetPlayerInterior(playerid,int[playerid]);