28.05.2017, 19:59
So basically, when a player dies it places text above their head but there is chance that it will stay even when you /revive them or they accept death. I have a feeling that it's got to do with when someone dies it updates in the database. Here is all the code that's got to do with the labels.
There is two modes: Brutally Wounded and Deathmode.
Revive command that has the removed label code
The text stays above the players head sometimes which is annoying and only fixed after a server restart, why is this?
There is two modes: Brutally Wounded and Deathmode.
PHP код:
new Text3D:label[MAX_PLAYERS];
new Text3D:label2[MAX_PLAYERS];
PHP код:
if(Character[playerid][BrutalM] == 0 && killerid != INVALID_PLAYER_ID)
{
GetPlayerPos(playerid, BMPos[0], BMPos[1], BMPos[2]);
Character[playerid][BrutalM] = 1;
Character[playerid][CanAccept] = 0;
LegHit[playerid] = 0;
format(DTextS, sizeof(DTextS), "(( %s is currently injured, type /damages %i for more info. ))", GetName(playerid), playerid);
label[playerid] = Create3DTextLabel(DTextS, COLOR_RED, BMPos[0], BMPos[1], BMPos[2], 10.0, 0);
Attach3DTextLabelToPlayer(label[playerid], playerid, 0, 0, 0.7);
PHP код:
public OnPlayerDisconnect(playerid, reason)
{
Delete3DTextLabel(label[playerid]);
Delete3DTextLabel(label2[playerid]);
There is more here, just hidden cus it's not neededd.
PHP код:
CMD:revive(playerid, params[])
{
new pID, str[128];
if(Account[playerid][Admin] >= 1)
{
if(sscanf(params, "u", pID)) return SendClientMessage(playerid, COLOR_GRAY, "/revive [id]");
Delete3DTextLabel(label[playerid]);
Delete3DTextLabel(label2[playerid]);
Character[pID][BrutalM] = 0;
Character[pID][Dead] = 0;
ResetPlayerDamages(pID);
LegHit[pID] = 0;
KillTimer(DeathT);
KillTimer(RTimer);
TogglePlayerControllable(pID, true);
ClearAnimations(pID);
format(str, sizeof(str), "Admin %s has just revived you.", GetRoleplayName(playerid));
SendClientMessage(pID, COLOR_SEAGREEN, str);
SetPlayerHealth(pID, 100.0);
}
else
{
SendErrorMessage(playerid, ERROR_ADMIN);
}
return 1;
}