03.07.2017, 02:01
I did that but I'm getting the same issue. I'm using a timer for some stuff.
It happens when the player is in AllowDamageMode and takes damage. Here is OnPlayerDamage
PHP код:
if (PlayerHealth <= 25 && Character[hitid][BrutalM] == 0 && hitid != INVALID_PLAYER_ID && IsPlayerConnected(hitid))
{
if(Character[hitid][BrutalM] == 0 && weaponid > 15)
{
GetPlayerPos(hitid, BMPos[hitid][0], BMPos[hitid][1], BMPos[hitid][2]);
Character[hitid][BrutalM] = 1;
Character[hitid][CanAccept] = 0;
LegHit[hitid] = 0;
ApplyAnim(hitid);
format(DTextS, sizeof(DTextS), "(( %s is currently injured, type /damages %i for more info. ))", GetName(hitid), hitid);
label[hitid] = Create3DTextLabel(DTextS, COLOR_RED, BMPos[hitid][0], BMPos[hitid][1], BMPos[hitid][2], 10.0, 0);
Attach3DTextLabelToPlayer(label[hitid], hitid, 0, 0, 0.7);
ClearPlayerWeapons(hitid);
SetTimerEx("AllowDamage", 3000, false, "i", hitid);
format(str, sizeof(str),"%s was brutally wounded by %s.",GetRoleplayName(hitid),GetRoleplayName(playerid));
SendAdminsMessage(1, COLOR_RED, str);
PHP код:
forward AllowDamage(playerid);
public AllowDamage(playerid)
{
AllowDamageMode[playerid] = 1;
return 1;
}
PHP код:
public OnPlayerDamage(&playerid, &Float:amount, &issuerid, &weapon, &bodypart)
{
new Float:PlayerHealth;
new str[256];
if(issuerid != INVALID_PLAYER_ID)
{
if(Character[playerid][BrutalM] == 0 && Character[playerid][Dead] == 0 && issuerid != INVALID_PLAYER_ID)
{
GetPlayerHealth(playerid, PlayerHealth);
if(amount > PlayerHealth) {
SetPlayerHealth(playerid, 20);
return 0;
}
}
if(Character[playerid][BrutalM] == 1 && issuerid != INVALID_PLAYER_ID)
{
GetPlayerHealth(playerid, PlayerHealth);
if(amount > PlayerHealth) {
SetPlayerHealth(playerid, 999);
return 1;
}
}
if(Character[playerid][BrutalM] == 1 && AllowDamageMode[playerid] == 1)
{
Delete3DTextLabel(label[playerid]);
label2[playerid] = Create3DTextLabel("(( THIS PLAYER IS DEAD ))", COLOR_RED, Character[playerid][DPosX], Character[playerid][DPosY], Character[playerid][DPosZ], 10.0, 0);
Attach3DTextLabelToPlayer(label2[playerid], playerid, 0, 0, 0.7);
Character[playerid][Dead] = 1;
Character[playerid][BrutalM] = 0;
AllowDamageMode[playerid] = 0;
ApplyAnim(playerid);
SCM(playerid, COLOR_YELLOW, ">> You are now dead. You can use /respawnme after 60 seconds to respawn.");
Character[playerid][CanSpawn] = 0;
RespawnT = 60;
RespawnEx = SetTimer("RespawnTimer", 999, true);
SetTimerEx("RespawnTimer2", 60000, false, "i", playerid);
format(str, sizeof(str),"%s was finished off by %s.",GetRoleplayName(playerid),GetRoleplayName(issuerid));
SendAdminsMessage(1, COLOR_LIGHTRED, str);
}