SAMP Death Problem.
#1

When I die, I do not spawn until drops one points of my HP (on my server, decrease life with 1HP every minute). I made a video to understand better.

https://*********/DFKFhzsBS4g


Callbacks:
OnPlayerDeath:
PHP код:
public OnPlayerDeath(playeridkilleridreason)
{
    new 
string[100];
    if(
killerid != INVALID_PLAYER_ID)
    {
        
PlayerInfo[killerid][pCrimes] ++;
        
Update(killeridpCrimesu);
        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);
        }
        if(
GetDistanceBetweenPlayers(playerid,killerid) > 100)
        {
            if(
GetPlayerWeapon(killerid) != reason)
            {
                new 
Avertizari[MAX_PLAYERS] = 0;
                
Avertizari[playerid]++;
                if(
Avertizari[playerid] > 2)
                {
                    
Kick(playerid);
                }
            }
        }
        new 
fpm,fkm;
        
fpm PlayerInfo[playerid][pMember];
        
fkm PlayerInfo[killerid][pMember];
        
        if(
InAntrenament[playerid] == && InAntrenament[killerid] == 1)
        {
            if(
fpm == fkm)
            {
                
SendDeathMsgToAntkilleridplayeridreason );
            }
        }
        if(
InWar[fpm] == && InWar[fkm] == 1)
        {
            for(new 
turf 1turf MaxGangZonesturf++)
            {        
                if(
WarInfo[turf][wTime] > 0)
                {
                    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 );
                            }
                        }
                    }
                }
            }
        }
        if(
PlayerPaintballing[playerid] != 0)
        {
            
SendDeathMsgToPBPlayerskilleridplayeridreason );
            
format(stringsizeof(string), "{ffc000}Paintball: L-ai omorat pe %s.",GetName(playerid));
            
SendClientMessage(killerid, -1string);
            
            
format(stringsizeof(string), "{ffc000}Paintball: Ai fost omorat de %s.",GetName(killerid));
            
SendClientMessage(playerid, -1string);
            
            new 
pinfo[75];
            
KillP[killerid]++;
            
format(pinfo,sizeof(pinfo),"%d - %d"KillP[killerid],DeathP[killerid]);
            
TextDrawSetString(Paintball[8][killerid], pinfo);
            
DeathP[playerid]++;
            
format(pinfo,sizeof(pinfo),"%d - %d"KillP[playerid],DeathP[playerid]);
            
TextDrawSetString(Paintball[8][playerid], pinfo);
            
PlayerPaintballScore[killerid] = KillP[killerid]-DeathP[killerid];
            if(
PlayerPaintballScore[killerid] > PaintballWinnerScore)
            {
                
PaintballWinner killerid;
                
PaintballWinnerScore PlayerPaintballScore[killerid];
                foreach(
Player,i)
                {
                    if(
IsPlayerConnected(i))
                    {
                        if(
PlayerPaintballing[i] != 0)
                        {
                            
format(pinfo,sizeof(pinfo),"%s, [%dp]",GetName(PaintballWinner),PaintballWinnerScore);
                            
TextDrawSetString(Paintball[7][i], pinfo);
                           }
                    }
                   }
            }
            return 
1;
        }
        new 
GunName[40];
        
GetWeaponName(reasonGunNamesizeof(GunName));
        
printf("[DEATH] %s a fost omorat de %s cu arma %s",GetName(playerid), GetName(killerid), GunName);
    }
    
killerid INVALID_PLAYER_ID;    
    return 
1;

OnPlayerSpawn:
PHP код:
public OnPlayerSpawn(playerid)
{
    if(
IsPlayerConnected(playerid))
    {
        
gIsPlayerAlive{playerid} = 1;
        
gPauseKillWarnings{playerid} = 0;
        
        new 
Float:viata[MAX_PLAYERS]; GetPlayerHealth(playeridviata[playerid]); if(viata[playerid] < 2SetPlayerHealth(playerid100);
        
        if (
GetPlayerVirtualWorld(playerid) != 0SetPlayerVirtualWorld(playerid0);
        
        
SetPlayerArmour(playerid0);
        print(
"ONPLAYERSPAWN");
        
SetPlayerFactionColor(playerid);
        if(
gLogged[playerid] == 0)
        {
            
KickEx(playerid, -1"{008BC7}Informatie: {ffffff}Inaintea spawn-ului este necesara logarea, ai primit kick.");
            return 
1;
         }
        
SetPlayerSpawn(playerid);
    }
    return 
1;

SetPlayerSpawn:
PHP код:
public SetPlayerSpawn(playerid)
{
    if(
IsPlayerConnected(playerid))
    {
        
SetPlayerFactionColor(playerid);
        
EnteredHouse[playerid] = -1;
        
InBussines[playerid] = -1;
        
//InHQ[playerid] = -1;
        
SetPlayerVirtualWorld(playerid0);
        if(
PlayerInfo[playerid][pSkin] > 0)
        {
            
SetPlayerSkin(playeridPlayerInfo[playerid][pSkin]);
        }
        else
        {
            
SetPlayerSkin(playeridSKINCIVILI);
        }
        if(
PlayerInfo[playerid][pTutorial] == 0)
        {
            
//SetPlayerCameraPos(playerid, 1500.7156,-1778.1880,80.3080);
            //SetPlayerCameraLookAt(playerid, 1500.7156,-1778.1880,80.3080);
            
SetPlayerPos(playerid1437.6957,-2266.6355,13.5469);
            
            
InterpolateCameraPos(playerid1926.135620, -1541.23413079.9620811678.029174, -1416.283325120.67912210000);
            
InterpolateCameraLookAt(playerid1922.052978, -1538.39318880.4731671673.200805, -1416.761108119.4713977000);
            
            
SetPlayerVirtualWorld(playeridplayerid 1);
            
ShowPlayerDialog(playeridDIALOG_SEXDIALOG_STYLE_MSGBOX"Sexul caracterului""Trebuie sa-ti alegi sexul.\nApasa butonul corespunzator !""Masculin""Feminin");
        }
        new 
rand;
        new 
house PlayerInfo[playerid][pPhousekey];
        if(
PlayerPaintballing[playerid] != 0)
        {
            
GivePlayerWeapon(playeridpgunp9999);
            
rand random(sizeof(PaintballSpawns));
            
SetPlayerPos(playeridPaintballSpawns[rand][0], PaintballSpawns[rand][1], PaintballSpawns[rand][2]);
               
SetPlayerInterior(playerid10);
            return 
1;
        }
        if(
PlayerInfo[playerid][pJailed] >= 1)
        {
            
SetPlayerWantedLevel(playerid0);
            
rand random(sizeof(gRandomJailSpawns));
            
SetPlayerPos(playerid,gRandomJailSpawns[rand][0],gRandomJailSpawns[rand][1],gRandomJailSpawns[rand][2]);
            
SendClientMessage(playerid, -1"{008BC7}Jail: {ffffff}Nu ti-ai terminat sentinta !");
            
TogglePlayerControllable(playerid0);
            
SetTimerEx("Unfreeze"10000"d"playerid);
            
SetPlayerSkin(playerid62);
            
SetPlayerInterior(playerid6);
            return 
1;
        }
        if(
InAntrenament[playerid] == 1)
        {
            
SetPlayerPos(playerid, -1130.0164,1057.7972,1346.4141);
            
SetPlayerFacingAngle(playerid87.7734);
            
SetPlayerInterior(playerid10);
            
PlayerInfo[playerid][pInterior] = 10;
            
GivePlayerWeapon(playerid339999);
            
GivePlayerWeapon(playerid299999);
            
GivePlayerWeapon(playerid249999);
            
GivePlayerWeapon(playerid319999);
            
GivePlayerWeapon(playerid19999);
            return 
1;
        }
        if(
house != 999)
        {
            if(
PlayerInfo[playerid][pSpawnChange] == 1)
            {
                
SetPlayerInterior(playeridHouseInfo[house][hInt]);
                
SetPlayerPos(playeridHouseInfo[house][hPosX1], HouseInfo[house][hPosY1],HouseInfo[house][hPosZ1]); 
                
PlayerInfo[playerid][pInterior] = HouseInfo[house][hInt];
                
EnteredHouse[playerid] = house;
                return 
1;
            }
        }
        if (
PlayerInfo[playerid][pMember] > && PlayerInfo[playerid][pMember] < 14// 
        
{
            new 
factionID PlayerInfo[playerid][pMember];
            
SetPlayerInterior(playeridDynamicFactions[factionID][fInterior]);
            
SetPlayerFacingAngle(playeridDynamicFactions[factionID][fAngle]);
            
SetPlayerVirtualWorld(playeridDynamicFactions[factionID][fVirtual]);
            
SetPlayerPos(playeridDynamicFactions[factionID][IntX], DynamicFactions[factionID][IntY], DynamicFactions[factionID][IntZ]);
            if(
factionID == || factionID == || factionID == || factionID == 8)
            {
                
GivePlayerWeapon(playerid2450);
            }
            return 
1;
        }
        if (
PlayerInfo[playerid][pMember] == || PlayerInfo[playerid][pLeader] == 0// Civilian
        
{
            
SetPlayerPos(playerid1742.9543,-1862.0375,13.5768);
            
SetPlayerFacingAngle(playerid359.5591);
            
SetPlayerInterior(playerid0);
            
SetPlayerVirtualWorld(playerid0);
            
PlayerInfo[playerid][pInterior] = 0;
            return 
1;
        }
    }
    return 
1;

Reply
#2

Bump.
Reply
#3

Is the problem only for a certain group of players, such as your Civilians? Or is it all players.

Notes:
- You don't need to check the virtual world before setting it if it's just going to be 0.
- You already have the SetPlayerVirtualWorld in SetPlayerSpawn so it isn't needed in OnPlayerSpawn.
- You don't need to check if the player is connected in OnPlayerSpawn.

Also, you're not allowed to bump a topic within 24 hours.
Reply
#4

Ok, sorry.
From what I saw, the problem is for everyone, no matter whether they are civilians or not.
Reply
#5

It seems that doing so even if I'm not on the same team. Other opinions? From what could be?
Reply
#6

Can you show us the script that drops 1 HP every minute?
Reply
#7

Quote:
Originally Posted by Aly
Посмотреть сообщение
Can you show us the script that drops 1 HP every minute?
PHP код:
public Timer1Min()
{
    foreach(
Playeri)
    {
        new 
Float:playerHP;
        
GetPlayerHealth(iplayerHP);
        
SetPlayerHealth(iplayerHP 1.0);
        }

Reply
#8

That seems to be fine, can you show me those 2 cmds: /sethp and /gethp?
I think you store the HP of the player on a variable.
Reply
#9

HP does not stored in a variable. I used SetPlayerHealth.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)