23.09.2015, 17:00
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:
OnPlayerSpawn:
SetPlayerSpawn:
https://*********/DFKFhzsBS4g
Callbacks:
OnPlayerDeath:
PHP код:
public OnPlayerDeath(playerid, killerid, reason)
{
new string[100];
if(killerid != INVALID_PLAYER_ID)
{
PlayerInfo[killerid][pCrimes] ++;
Update(killerid, pCrimesu);
if(GetPlayerState(killerid) == PLAYER_STATE_DRIVER && !IsAPlane(GetPlayerVehicleID(killerid)))
{
format(string, sizeof(string), "AdmWarning: %s [%d] a fost omorat de %s [%d] folosind metoda `Drive-By`.", GetName(playerid), playerid, GetName(killerid), killerid);
AdminsBroadCast(COLOR_LIGHTRED, string);
}
if(GetDistanceBetweenPlayers(killerid, playerid) > 90 && reason != 34 && reason != 33)
{
new gunname[50];
GetWeaponName(reason, gunname, sizeof(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_LIGHTRED, string);
}
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] == 1 && InAntrenament[killerid] == 1)
{
if(fpm == fkm)
{
SendDeathMsgToAnt( killerid, playerid, reason );
}
}
if(InWar[fpm] == 1 && InWar[fkm] == 1)
{
for(new turf = 1; turf < MaxGangZones; turf++)
{
if(WarInfo[turf][wTime] > 0)
{
if(IsPlayerInTurf(playerid, turf) && IsPlayerInTurf(killerid, turf))
{
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(string, sizeof(string), "{0099FF}Razboi: {FFFFFF}L-ai omorat pe %s si ai primit 25$! (Turf ID: %d)",GetName(playerid), turf);
SCM(killerid, 0x0080FFFF, string);
GivePlayerCash(killerid, 25);
GivePlayerCash(playerid, -10);
format(string, sizeof(string), "{0099FF}Razboi: {FFFFFF}Ai fost omorat de %s! (Turf ID: %d)",GetName(killerid), turf);
SCM(playerid, 0x0080FFFF, string);
GameTextForPlayer(killerid, "~g~+$25", 600, 1);
GameTextForPlayer(playerid, "~r~-$10", 600, 1);
SendDeathMsgToWar( killerid, playerid, reason );
}
}
}
}
}
}
if(PlayerPaintballing[playerid] != 0)
{
SendDeathMsgToPBPlayers( killerid, playerid, reason );
format(string, sizeof(string), "{ffc000}Paintball: L-ai omorat pe %s.",GetName(playerid));
SendClientMessage(killerid, -1, string);
format(string, sizeof(string), "{ffc000}Paintball: Ai fost omorat de %s.",GetName(killerid));
SendClientMessage(playerid, -1, string);
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(reason, GunName, sizeof(GunName));
printf("[DEATH] %s a fost omorat de %s cu arma %s",GetName(playerid), GetName(killerid), GunName);
}
killerid = INVALID_PLAYER_ID;
return 1;
}
PHP код:
public OnPlayerSpawn(playerid)
{
if(IsPlayerConnected(playerid))
{
gIsPlayerAlive{playerid} = 1;
gPauseKillWarnings{playerid} = 0;
new Float:viata[MAX_PLAYERS]; GetPlayerHealth(playerid, viata[playerid]); if(viata[playerid] < 2) SetPlayerHealth(playerid, 100);
if (GetPlayerVirtualWorld(playerid) != 0) SetPlayerVirtualWorld(playerid, 0);
SetPlayerArmour(playerid, 0);
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;
}
PHP код:
public SetPlayerSpawn(playerid)
{
if(IsPlayerConnected(playerid))
{
SetPlayerFactionColor(playerid);
EnteredHouse[playerid] = -1;
InBussines[playerid] = -1;
//InHQ[playerid] = -1;
SetPlayerVirtualWorld(playerid, 0);
if(PlayerInfo[playerid][pSkin] > 0)
{
SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]);
}
else
{
SetPlayerSkin(playerid, SKINCIVILI);
}
if(PlayerInfo[playerid][pTutorial] == 0)
{
//SetPlayerCameraPos(playerid, 1500.7156,-1778.1880,80.3080);
//SetPlayerCameraLookAt(playerid, 1500.7156,-1778.1880,80.3080);
SetPlayerPos(playerid, 1437.6957,-2266.6355,13.5469);
InterpolateCameraPos(playerid, 1926.135620, -1541.234130, 79.962081, 1678.029174, -1416.283325, 120.679122, 10000);
InterpolateCameraLookAt(playerid, 1922.052978, -1538.393188, 80.473167, 1673.200805, -1416.761108, 119.471397, 7000);
SetPlayerVirtualWorld(playerid, playerid + 1);
ShowPlayerDialog(playerid, DIALOG_SEX, DIALOG_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(playerid, pgunp, 9999);
rand = random(sizeof(PaintballSpawns));
SetPlayerPos(playerid, PaintballSpawns[rand][0], PaintballSpawns[rand][1], PaintballSpawns[rand][2]);
SetPlayerInterior(playerid, 10);
return 1;
}
if(PlayerInfo[playerid][pJailed] >= 1)
{
SetPlayerWantedLevel(playerid, 0);
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(playerid, 0);
SetTimerEx("Unfreeze", 1000, 0, "d", playerid);
SetPlayerSkin(playerid, 62);
SetPlayerInterior(playerid, 6);
return 1;
}
if(InAntrenament[playerid] == 1)
{
SetPlayerPos(playerid, -1130.0164,1057.7972,1346.4141);
SetPlayerFacingAngle(playerid, 87.7734);
SetPlayerInterior(playerid, 10);
PlayerInfo[playerid][pInterior] = 10;
GivePlayerWeapon(playerid, 33, 9999);
GivePlayerWeapon(playerid, 29, 9999);
GivePlayerWeapon(playerid, 24, 9999);
GivePlayerWeapon(playerid, 31, 9999);
GivePlayerWeapon(playerid, 1, 9999);
return 1;
}
if(house != 999)
{
if(PlayerInfo[playerid][pSpawnChange] == 1)
{
SetPlayerInterior(playerid, HouseInfo[house][hInt]);
SetPlayerPos(playerid, HouseInfo[house][hPosX1], HouseInfo[house][hPosY1],HouseInfo[house][hPosZ1]);
PlayerInfo[playerid][pInterior] = HouseInfo[house][hInt];
EnteredHouse[playerid] = house;
return 1;
}
}
if (PlayerInfo[playerid][pMember] > 0 && PlayerInfo[playerid][pMember] < 14) //
{
new factionID = PlayerInfo[playerid][pMember];
SetPlayerInterior(playerid, DynamicFactions[factionID][fInterior]);
SetPlayerFacingAngle(playerid, DynamicFactions[factionID][fAngle]);
SetPlayerVirtualWorld(playerid, DynamicFactions[factionID][fVirtual]);
SetPlayerPos(playerid, DynamicFactions[factionID][IntX], DynamicFactions[factionID][IntY], DynamicFactions[factionID][IntZ]);
if(factionID == 5 || factionID == 6 || factionID == 7 || factionID == 8)
{
GivePlayerWeapon(playerid, 24, 50);
}
return 1;
}
if (PlayerInfo[playerid][pMember] == 0 || PlayerInfo[playerid][pLeader] == 0) // Civilian
{
SetPlayerPos(playerid, 1742.9543,-1862.0375,13.5768);
SetPlayerFacingAngle(playerid, 359.5591);
SetPlayerInterior(playerid, 0);
SetPlayerVirtualWorld(playerid, 0);
PlayerInfo[playerid][pInterior] = 0;
return 1;
}
}
return 1;
}