Death Problem
#1

Hello SA-MP community!

Im facing a really serious problem on my source.

Onplayerdeath callback theres a problem: When i fall from heights or have and invalid death my hp goes to 0 and the player stucks , and i cant do any action!

Code:
PHP код:
public OnPlayerDeath(playerid,killerid,reason)
{
    if(
License[playerid][StepB] >=1||License[playerid][StepD] >=1||License[playerid][StepF] >=1)
    {
        
License[playerid][StepB]=0;
        
License[playerid][StepF]=0;
        
License[playerid][StepD]=0;
        
DisablePlayerRaceCheckpoint(playerid);
        
DestroyVehicle(License[playerid][Vehicle]);
        
SendClientMessage(playerid,LRED,"You have failed the test");
    }
    if(
PB[playerid]==0)
    {
        
Died[playerid]=1;
        
SendDeathMessage(killerid,playerid,reason);
    }
    if(
killerid !=INVALID_PLAYER_ID)
    {
          if(
PB[playerid]==1)
         {
            new 
str[128];
            
format(str,sizeof(str),"'%s' has been terminated by '%s'",PlayerName(playerid),PlayerName(killerid));
            
GivePlayerMoneyEx(killerid,200);
            
SendNearbyMessage(playerid,250,str,RED);
            
GameTextForPlayer(killerid,"~g~+$200",3000,1);
        }
        if(
PB[playerid]==0)
         {
            if(
PlayerOrgType(killerid)==LAW&&GetPlayerWantedLevel(playerid) >=1)
            {
                 new 
string[128];
                
Died[playerid]=0;
                
Jailed[playerid]=2;
                new 
rand=100 +random(1000);
                
GivePlayerMoneyEx(killerid,rand);
                 
format(string,sizeof(string),"~g~+$%i",rand);
                 
GameTextForPlayer(killerid,string,3000,1);
                 
format(string,sizeof(string),"%s has been arrested by Officer %s",PlayerName(playerid),PlayerName(killerid));
                  
SendClientMessageToAll(RED,string);
                if(
PlayerAwards[killerid][Jailer]==0)
                {
                     
GivePlayerMoneyEx(killerid,800);
                    
PlayerAwards[killerid][Jailer]=1;
                     
GamerScore[playerid]=GamerScore[playerid]+50;
                      
SendClientMessage(killerid,YELLOW,"Achievement Unlocked: {FFFFFF}Cleaning The Streets!");
                    
SendClientMessage(killerid,LGREEN,"BONUS: $800 || +50 Gamer Score");
                }
            }
            if(
PlayerOrgType(killerid)!=LAW)
            {
                
format(Reason[killerid],25,"Murder");
                
SetPlayerWantedLevel(killerid,GetPlayerWantedLevel(killerid)+2);
                for(new 
a=0;a<MAX_PLAYERS;a++)
                {
                    if(
IsPlayerConnectedEx(a))
                       {
                           new 
str[128];
                        if(
PlayerOrgType(a)==LAW)
                         {
                            
format(str,sizeof(str),"RADIO - %s has been reported for a murder",PlayerName(killerid));
                               
SendClientMessage(a,BLUE,str);
                        }
                        
GetPlayerPos(playerid,pX[playerid],pY[playerid],pZ[playerid]);
                        if(
IsPlayerInRangeOfPoint(a,7,pX[playerid],pY[playerid],pZ[playerid]))
                        {
                            if(
a!=playerid&&a!=killerid)
                            {
                                
format(str,sizeof(str),"You saw how badly %s was murdered by %s",PlayerName(playerid),PlayerName(killerid));
                                   
SendClientMessage(a,BLUE,str);
                            }
                            }
                    }
                }
            }
        }
    }
    if(
killerid==INVALID_PLAYER_ID)
    {
        if(
PlayerAwards[playerid][Suicide]==0)
        {
               
GivePlayerMoneyEx(playerid,250);
            
PlayerAwards[playerid][Suicide]=1;
            
GamerScore[playerid]=GamerScore[playerid]+60;
              
SendClientMessage(playerid,YELLOW,"Achievement Unlocked: {FFFFFF}Good Bye Cruel World!");
              
SendClientMessage(playerid,LGREEN,"BONUS: $250 || +60 Gamer Score");
        }
    }
    if(
GetPlayerMoneyEx(playerid) > 4)
    {
        
GivePlayerMoneyEx(playerid,-GetPlayerMoneyEx(playerid)/2);
    }
    if(
IsRobbing[playerid]==1)
    {
        
Died[playerid]=1;
        
rcash[playerid]=0;
        
IsRobbing[playerid]=0;
        
SendDeathMessage(killerid,playerid,reason);
        
SendClientMessage(playerid,LRED,"Robbery failed,you lost all of your loot");
    }
    
Suited[playerid]=0;
    
IsBleeding[playerid]=0;
    
SetPlayerInterior(playerid,0);
    
ResetPlayerWeaponsEx(playerid);
    
SetPlayerVirtualWorld(playerid,0);
    
SetPlayerSkin(playerid,Skin[playerid]);
    
TextDrawHideForPlayer(playerid,Textdraw1);
    
TextDrawHideForPlayer(playerid,Textdraw2);
    
TextDrawHideForPlayer(playerid,Textdraw3);
    
TextDrawHideForPlayer(playerid,Textdraw4);
    
TextDrawHideForPlayer(playerid,Textdraw5);
    
TextDrawHideForPlayer(playerid,Zones[playerid]);
    
SetPlayerFightingStyle(playerid,Fstyle[playerid]);
     return 
1;

I think i located the problem on line:
PHP код:
    if(killerid==INVALID_PLAYER_ID
    { 
        if(
PlayerAwards[playerid][Suicide]==0
        { 
               
GivePlayerMoneyEx(playerid,250); 
            
PlayerAwards[playerid][Suicide]=1
            
GamerScore[playerid]=GamerScore[playerid]+60
              
SendClientMessage(playerid,YELLOW,"Achievement Unlocked: {FFFFFF}Good Bye Cruel World!"); 
              
SendClientMessage(playerid,LGREEN,"BONUS: $250 || +60 Gamer Score"); 
        } 
    } 
Any solution? (sorry no video can be uploaded)

Thank you!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)