08.03.2013, 03:44
I'm a bit confused here. I'm attempting to implement a "Talent" for my server, which is named Second Chance. This is what it's suppose to do: When you die, you will spawn at your death location with 50 health. Then the next death, you will spawn at the "normal" spawn. Then after that, you will then again spawn at the death location. I'm trying to find a way to not make it so you spawn at your death location EVERY death. So I've created a variable, and tried to implement it. But it just doesn't seem to work for me.
Help is appreciated. Here's my current variable, and code.
I'm really confused as to what to do next.
Help is appreciated. Here's my current variable, and code.
pawn Код:
//Global Variables
new Float:sx, Float:sy, Float:sz;
//
new revive[MAX_PLAYERS];
--------------
// Under OnPlayerSpawn.
if(PlayerInfo[playerid][pTalent] == 4)
{
if(revive[playerid] == 1)
{
revive[playerid] = 0;
SetPlayerPos(playerid, sx, sy, sz);
SetPlayerHealth(playerid, 50);
SendClientMessage(playerid,COLOR_GREEN, "(Second Chance Talent): You will now respawn at your death location with 50 health.");
}
}
// Under OnPlayerDeath
if(PlayerInfo[playerid][pTalent] == 4)
{
if(revive[playerid] == 1)
{
revive[playerid] = 0;
}
revive[playerid] = 1;
GetPlayerPos(playerid, sx, sy, sz);
}