05.04.2014, 09:09
Dear SA-MP community,
I have been working on my own GM but I have some troubles with the death system.
The first time you die it sends you to class selection, after you press the spawn button, you will spawn at your death position and you will do the anim.
The second time you are spawning immediatly.
Video:
https://www.youtube.com/watch?v=rh73VMIBqkA
OnPlayerDeath:
OnPlayerSpawn:
Debug puts out:
I have been working on my own GM but I have some troubles with the death system.
The first time you die it sends you to class selection, after you press the spawn button, you will spawn at your death position and you will do the anim.
The second time you are spawning immediatly.
Video:
https://www.youtube.com/watch?v=rh73VMIBqkA
OnPlayerDeath:
PHP код:
if(AccountData[playerid][pPrisoned] >= 1)
{
SetPlayerInterior(playerid, 6);
SetPlayerVirtualWorld(playerid, 1);
SetPlayerColor(playerid, 0xED9111FF);
SetPlayerPos(playerid, 264.2733, 77.4141, 1001.0391);
SetPlayerFacingAngle(playerid, 269.7870);
TogglePlayerControllable(playerid, 1);
SetPlayerHealth(playerid, 100);
SetPlayerArmour(playerid, 100);
return 1;
}
else
{
switch(PlayerJustDied[playerid])
{
case 1:
{
PlayerJustDied[playerid] = 0;
AccountData[playerid][pHospitalized] = 1;
printf("1: Player %d is dieng | Just died? %d", playerid, PlayerJustDied[playerid]);
}
case 0:
{
GetPlayerPos(playerid, DeathStuff[playerid][DeathX], DeathStuff[playerid][DeathY], DeathStuff[playerid][DeathZ]);
GetPlayerFacingAngle(playerid, DeathStuff[playerid][DeathA]);
DeathStuff[playerid][DeathInt] = GetPlayerInterior(playerid);
DeathStuff[playerid][DeathHP] = 100;
for(new i = 0; i<13;i++)
{
GetPlayerWeaponData(playerid, i, DeathWeapons[playerid][i][0], DeathWeapons[playerid][i][1]);
}
PlayerJustDied[playerid] = 1;
AccountData[playerid][pHospitalized] = 0;
printf("0: Player %d is dieng | Just died? %d", playerid, PlayerJustDied[playerid]);
}
}
}
PHP код:
if (PlayerJustDied[playerid])
{
SetPlayerPos(playerid, DeathStuff[playerid][DeathX], DeathStuff[playerid][DeathY], DeathStuff[playerid][DeathZ]);
SetPlayerInterior(playerid, DeathStuff[playerid][DeathInt]);
SetPlayerFacingAngle(playerid, DeathStuff[playerid][DeathA]);
SetPlayerSkin(playerid, AccountData[playerid][pSkin]);
DeathStuff[playerid][DeathHP] = 100;
displayCenterHUDInfo(playerid, "~r~Injured~n~~w~/accept death or /service ems", 8);
SetPlayerArmour(playerid, 0.0);
SetPlayerHealth(playerid, 100.0);
ClearAnimations(playerid);
ApplyAnimation(playerid, "KNIFE", "KILL_Knife_Ped_Die",4.0,0,1,1,1,0,1);
for(new i = 0;i<13;i++)
{
GivePlayerValidWeapon(playerid, DeathWeapons[playerid][i][0], DeathWeapons[playerid][i][1]);
}
SetTimerEx("DeathTimer", 1000, false, "i", playerid);
return 1;
}
PHP код:
[11:07:42] 0: Player 0 is dieng | Just died? 1
[11:07:42] [death] Yason_Wrath died 255
[11:07:59] AdmCmd: Yason Wrath has revived Yason Wrath.
[11:08:07] 0: Player 0 is dieng | Just died? 1