SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 21/03/2019, 06:10 AM   #1
KinxpIn
Little Clucker
 
Join Date: Dec 2018
Posts: 25
Reputation: 0
Post [HELP] Death Bug

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 Code:
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;

KinxpIn is offline   Reply With Quote
Old 21/03/2019, 07:30 AM   #2
KinxpIn
Little Clucker
 
Join Date: Dec 2018
Posts: 25
Reputation: 0
Default Re: [HELP] Death Bug

help guys?
KinxpIn is offline   Reply With Quote
Old 21/03/2019, 08:46 AM   #3
Kaliber
High-roller
 
Kaliber's Avatar
 
Join Date: Jun 2012
Location: Localhost
Posts: 1,091
Reputation: 156
Default Re: [HELP] Death Bug

What does incccLowerBlood does?

And remove SpawnPlayer from OnPlayerDeath
__________________
Kaliber is offline   Reply With Quote
Old 21/03/2019, 09:07 AM   #4
KinxpIn
Little Clucker
 
Join Date: Dec 2018
Posts: 25
Reputation: 0
Default Re: [HELP] Death Bug

Quote:
Originally Posted by Kaliber View Post
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
KinxpIn is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Include] [N]Death Sequence - GTA 5 Style Death sequence! Nickk888 Includes 4 18/05/2018 08:48 AM
on player death - cant spawn after death Oshery Scripting Help 20 29/12/2017 09:43 PM
[GameMode] Death Cave:Death Match [custom map] andrewgrob Gamemode Scripts 4 30/03/2013 03:53 PM
need help death wont show in death box lily wayne Help Archive 2 17/08/2009 02:34 AM


All times are GMT. The time now is 08:52 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.