PDA

View Full Version : Death System


0nur
29/01/2015, 02:34 AM
Hi all,

Death system bug. Why don't work ?



I DİED;


http://i.hizliresim.com/W6P8Mm.png (http://hizliresim.com/W6P8Mm)

Spawn Click;

http://i.hizliresim.com/31VWb0.png (http://hizliresim.com/31VWb0)


OnPlayerSpawn;

public OnPlayerSpawn(playerid)
{
// Checking for their variable..
if(pDied[playerid] == 1)
{
// Spawning at ASGH in Los Santos...
pDied[playerid] = 0;
SetPlayerPos(playerid, 1177.8596, -1324.0876, 14.0915);
// Message and money removal (using -400 at GivePlayerMoney to fine 500 as you automaticly lose $100 when you die).
SendClientMessage(playerid, col_grey, "{639E4D}INFO:{ADADAD} You have just respawned and you lost $500!");
GivePlayerMoney(playerid, -400);
}
return 1;
}


OnPlayerDeath;

public OnPlayerDeath(playerid, killerid, reason)
{
PlayerInfo[killerid][pKills]++;
PlayerInfo[playerid][pDeaths]++;
/*SetPlayerPos(playerid, 982.1890, -1624.2583, 14.9526);
SetPlayerFacingAngle(playerid, 90);
*/
new Float:x, Float:y, Float:z;
// Resetting their position:
GetPlayerPos(playerid, x, y, z);
SetPlayerPos(playerid, x, y, z);

// Freezing them in death, aka not allowing them to respawn:
TogglePlayerControllable(playerid, 0);
ApplyAnimation(playerid, "CRACK", "crckdeth1", 4.1, 0, 1, 1, 1, 1, 1);

// Informing them and activating timer:
SendClientMessage(playerid, col_grey, "{639E4D}INFO:{ADADAD} You have been brutally wounded! If someone doesn't revive you soon, you will die!");
SetTimerEx("DeathTimer", 3200, false, "i", playerid);

return 1;
}


Death Timer;

public DeathTimer(playerid)
{
// As seen here: informing them and enabling variable:
SendClientMessage(playerid, col_grey, "{639E4D}INFO:{ADADAD} Nobody managed to save you in time, you died!");
pDied[playerid] = 1;

// PlayerControllable to true...
TogglePlayerControllable(playerid, 1);
return 1;
}

Arastair
29/01/2015, 04:43 AM
You mean, you'll fall into the map after killing yourself? Or what? Giving the codes won't mean much, explain your problem

0nur
29/01/2015, 12:06 PM
When I died fall in map out.

0nur
29/01/2015, 01:12 PM
After the death throw to me map out