SA-MP Forums Archive
[HELP] Death Bug - 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: [HELP] Death Bug (/showthread.php?tid=665068)



[HELP] Death Bug - KinxpIn - 21.03.2019

So, I want to make after the player dies, will return to the position where he died with injured status. But what happens instead is that the player is sent to the blueberry chord, and sends "You're injured ..." continuously

Quote:

CODE:

PHP код:
PKed(playeridreason)
{
    if(
reason == 1)
    {
        
SetPVarInt(playerid"forcedeath"0);
    }
    if(
reason == 2)
    {
    }
    
pInfo[playerid][pInjured] = 0;
    
pInfo[playerid][pHS] = 0;
    
pInfo[playerid][pTS] = 0;
    
pInfo[playerid][pGS] = 0;
    
pInfo[playerid][pLAS] = 0;
    
pInfo[playerid][pRAS] = 0;
    
pInfo[playerid][pLLS] = 0;
    
pInfo[playerid][pRLS] = 0;
    
incccLowerBlood(playerid);
    
cmd_sendtols(playerid"");
    
TogglePlayerControllable(playerid1);
}
SetPlayerSpawn(playerid)
{
    if(
IsPlayerConnected(playerid))
    {
        if(
pInfo[playerid][pInjured] == 1)
        {
            
ShowPlayerBloodScreen(playeridBLOOD_TYPE_1);
            if(
pInfo[playerid][pTempSkin] > 0)
            {
                
SetPlayerSkin(playeridpInfo[playerid][pTempSkin]);
            }
            else
            {
                
SetPlayerSkin(playeridpInfo[playerid][pSkin]);
            }
            
SCM(playeridCOLOR_LIGHTRED"INJURED: {FFFFFF}You're injured. type /forcedeath to force respawn in hospital");
            
SetPlayerPos(playeridpInfo[playerid][DeathX], pInfo[playerid][DeathY], pInfo[playerid][DeathZ]);
            
SetPlayerVirtualWorld(playeridpInfo[playerid][DeathVW]);
            
SetPlayerInterior(playeridpInfo[playerid][DeathInt]);
            
//ClearAnimations(playerid);
            //SetPlayerHealth(playerid, 9999);
            
SetPlayerHealth(playeridFloat:0x7FFFFFFF);
            
SetPlayerArmour(playerid,0);
            
ClearAnimations(playerid);
            
ApplyAnimation(playerid"PED""KO_SKID_FRONT"4.0011101);
            
TogglePlayerControllable(playerid0);
        }
    }
    return 
1;
}
public 
OnPlayerDeath(playeridkilleridreason)
{
    
SpawnPlayer(playerid);
    
GetPlayerPos(playeridpInfo[playerid][DeathX], pInfo[playerid][DeathY], pInfo[playerid][DeathZ]);
    
pInfo[playerid][DeathVW] = GetPlayerVirtualWorld(playerid);
    
pInfo[playerid][DeathInt] = GetPlayerInterior(playerid);
    
sweeper 0;
    
SetPlayerColor(playeridCOLOR_CIVIL);
    
Player_ResetCutting(playerid);
    
Player_DropLog(playerid1);
    
//SetPlayerHealth(playerid, 100);
    
SetPlayerHealth(playerid9999);
    if(
pInfo[playerid][pInjured] == 1)
    {
        
PKed(playerid2);
    }
    
pInfo[playerid][pInjured] = 1;
    return 
1;
}
public 
OnPlayerSpawn(playerid)
{
    
//====================================================================================================================================================
    // spawn the player to their last saved position
    //mysql_format(g_SQL, query, sizeof query, "SELECT * FROM `x` = %f, `y` = %f, `z` = %f, `angle` = %f, `interior` = %d WHERE `id` = %d LIMIT 1", pInfo[playerid][X_Pos], pInfo[playerid][Y_Pos], pInfo[playerid][Z_Pos], pInfo[playerid][A_Pos], pInfo[playerid][pInterior], pInfo[playerid][ID]);
    
SetPlayerInterior(playeridpInfo[playerid][pInterior]);
    
SetPlayerPos(playeridpInfo[playerid][X_Pos], pInfo[playerid][Y_Pos], pInfo[playerid][Z_Pos]);
    
SetPlayerFacingAngle(playeridpInfo[playerid][A_Pos]);
    
SetCameraBehindPlayer(playerid);
    
/* HOUSE OPS */
    
InHouse[playerid] = INVALID_HOUSE_ID;
    
    new 
query[250];
    
mysql_format(g_SQLquerysizeof(query), "SELECT * FROM housesales WHERE OldOwner='%e'"GetName(playerid));
    
mysql_tquery(g_SQLquery"HouseSaleMoney""i"playerid);
    
//====================================================================================================================================================
    /* BUSINESS OPS */
    
InBusiness[playerid] = INVALID_BUSINESS;
    
    
mysql_format(g_SQLquerysizeof(query), "SELECT * FROM business_transactions WHERE OldOwner='%e'"GetName(playerid));
    
mysql_tquery(g_SQLquery"BusinessSaleMoney""i"playerid);
    
//===================================================================================================================================================
    
if(pInfo[playerid][pMuted] == true)
    {
        
SendClientMessageEx(playeridCOLOR_TOMATO"You are currently muted. You have %i minutes left for your mute to be gone."pInfo[playerid][pMutedTime] / 60);
    }
    if(
pInfo[playerid][pJailed] == true)
    {
        
SendClientMessageEx(playeridCOLOR_TOMATO"You are currently jailed. You have %i minutes left for you to be released."pInfo[playerid][pJailedTime] / 60);
    }
    
SetPlayerSpawn(playerid); // THIS THIS THIS THIS
    
return 1;




Re: [HELP] Death Bug - KinxpIn - 21.03.2019

help guys?


Re: [HELP] Death Bug - Kaliber - 21.03.2019

What does incccLowerBlood does?

And remove SpawnPlayer from OnPlayerDeath


Re: [HELP] Death Bug - KinxpIn - 21.03.2019

Quote:
Originally Posted by Kaliber
Посмотреть сообщение
What does incccLowerBlood does?

And remove SpawnPlayer from OnPlayerDeath
oh, thank you for the solution ...
I have solved this problem ... the solution is just removing setplayerhealth 0x7fffff