OnPlayerDeath problem - Not Spawn Player.
#1

Hi, I have a problem OnPlayerDeath callback.
After a player dies, he can still walk, can shoot a gun, etc. It is only the dead have seen other players. How can I solve this problem?
I tried to put SpawnPlayer (playerid);, but you regenerate too quickly and cause crashes.

PHP код:
public OnPlayerDeath(playeridkilleridreason)

    new 
string[100];
    
PlayerEnterTime[playerid] += 221;
    if(
Trailer[playerid] != INVALID_VEHICLE_ID)
    {
        
DestroyVehicle(Trailer[playerid]);
    }
    
Munceste[playerid] = 0;
    if(
JobVehicle[playerid] != INVALID_VEHICLE_ID)
    {
        
DestroyVehicle(JobVehicle[playerid]);
    }
    
DisablePlayerCheckpoint(playerid);
    
    
PlayerTextDrawHide(playeridTruckerTD[playerid]);
    
PlayerTextDrawHide(playeridTruckerTD2[playerid]);
    
PlayerTextDrawHide(playeridTruckerTD3[playerid]);
    
PlayerTextDrawHide(playeridTruckerTD4[playerid]);
    
    
PlayerTextDrawHide(playeridKilom1[playerid]);
    
PlayerTextDrawHide(playeridKilom2[playerid]);
    
PlayerTextDrawHide(playeridKilom3[playerid]);
    
PlayerTextDrawHide(playeridKilom4[playerid]);
    
PlayerTextDrawHide(playeridKilom5[playerid]);
    
    
PlayerTextDrawHide(playeridBoxDMV1[playerid]);
    
PlayerTextDrawHide(playeridInfoDMV[playerid]);
    
PlayerTextDrawHide(playeridSfat1DMV[playerid]);
    
PlayerTextDrawHide(playeridTimpRamasDMV[playerid]);
    
PlayerTextDrawHide(playeridBoxDMV2[playerid]);
    
PlayerTextDrawHide(playeridBoxDMV3[playerid]);
    
PlayerTextDrawHide(playeridBoxDMV4[playerid]);
    
PlayerTextDrawHide(playeridSfat2DMV[playerid]);
    
    if(
DutyOn[playerid] != 0)
    {
        
DutyOn[playerid] = 0;
    }
    if(
killerid != INVALID_PLAYER_ID)
    {
        if(
GetPlayerState(killerid) == PLAYER_STATE_DRIVER && !IsAPlane(GetPlayerVehicleID(killerid)))
        {
            
format(stringsizeof(string), "AdmWarning: %s [%d] a fost omorat de %s [%d] folosind metoda `Drive-By`."GetName(playerid), playeridGetName(killerid), killerid);
            
AdminsBroadCast(COLOR_LIGHTREDstring);
        }
        if(
GetDistanceBetweenPlayers(killeridplayerid) > 90 && reason != 34 && reason != 33)
        {
            new 
gunname[50];
            
GetWeaponName(reasongunnamesizeof(gunname));
            
format(string,sizeof(string),"AdmWarning: %s l-a omorat pe %s de la distanta de %.0f metri cu arma %s.",GetName(killerid),GetName(playerid), GetDistanceBetweenPlayers(killerid,playerid), gunname);
            
AdminsBroadCast(COLOR_LIGHTREDstring);
        }
        new 
fpm,fkm;
        
fpm PlayerInfo[playerid][pMember];
        
fkm PlayerInfo[killerid][pMember];
        for(new 
turf 1turf sizeof(TurfInfo); turf++)
        {            
            if(
IsPlayerInTurf(playeridturf) && IsPlayerInTurf(killeridturf))
            {
                if(
IsAMember(playerid) && IsAMember(killerid))
                {
                    if(
WarInfo[turf][wFaction] == fpm && WarInfo[turf][wAttacker] == fkm || WarInfo[turf][wFaction] == fkm && WarInfo[turf][wAttacker] == fpm)
                    {
                        if(
fkm == WarInfo[turf][wAttacker] || fkm == WarInfo[turf][wFaction])
                        {
                            
WarScoreF[fkm][turf] += 1.0;
                        }
                        
ucideri[killerid][turf] ++;
                        
decese[playerid][turf] ++;
                        if(
PlayerInfo[killerid][pMember] == WarInfo[turf][wAttacker])
                        {
                            if(
ucideri[killerid][turf] > bestscoreat[turf])
                            {
                                
bestscoreat[turf] = ucideri[killerid][turf];
                                
bestmemberat[turf] = killerid;
                            }
                        }
                        if(
PlayerInfo[killerid][pMember] == WarInfo[turf][wFaction])
                        {
                            if(
ucideri[killerid][turf] > bestscoredf[turf])
                            {
                                
bestscoredf[turf] = ucideri[killerid][turf];
                                
bestmemberdf[turf] = killerid;
                            }
                        }
                        if(
PlayerInfo[playerid][pMember] == WarInfo[turf][wAttacker])
                        {
                            if(
decese[playerid][turf] > worstscoreat[turf])
                            {
                                
worstscoreat[turf] = decese[playerid][turf];
                                
worstmemberat[turf] = playerid;
                            }
                        }
                        if(
PlayerInfo[playerid][pMember] == WarInfo[turf][wFaction])
                        {
                            if(
decese[playerid][turf] > worstscoredf[turf])
                            {
                                
worstscoredf[turf] = decese[playerid][turf];
                                
worstmemberdf[turf] = playerid;
                            }
                        }
                        
format(stringsizeof(string), "{0099FF}Razboi: {FFFFFF}L-ai omorat pe %s si ai primit 25$! (Turf ID: %d)",GetName(playerid), turf);
                         
SCM(killerid0x0080FFFFstring);
                         
GivePlayerCash(killerid25);
                         
GivePlayerCash(playerid, -10);
                         
format(stringsizeof(string), "{0099FF}Razboi: {FFFFFF}Ai fost omorat de %s! (Turf ID: %d)",GetName(killerid), turf);
                         
SCM(playerid0x0080FFFFstring);
                        
GameTextForPlayer(killerid"~g~+$25"6001);
                        
GameTextForPlayer(playerid"~r~-$10"6001);
                        
SendDeathMsgToWarkilleridplayeridreason );
                    }
                }
            }
        }
    }
    return 
1;

Reply
#2

Toggle him so he isn't controllable until he spawns.
Reply
#3

I mean to put TogglePlayerControllable(playerid, 0); the OnPlayerDeath and 1 to OnPlayerSpawn?
Reply
#4

I put this, but not working..
Other methods?
Reply
#5

Bump.
Reply
#6

Anyone.. ?
Reply
#7

I would suggest you to freeze the player and add a desire animation (mostly "crack anim")

About toogle controlable of player is useful, just saw us what you did in the script and it didn't work!
Reply
#8

I set player uncontrollable to OnPlayerDeath and controllable at OnPlayerSpawn. It's good ? I will try your method, the animation.

Here is a video: https://www.youtube.com/watch?v=Xc59...ature=*********

@I did as you said, with animation, but it does not work that way. : http://i.imgur.com/gWMdKjB.png
The player still does not regenerate.
Reply
#9

Bump..
Reply
#10

Buump
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)