03.02.2015, 17:31
I have a textdraw that turns your screen black when you die and type /accept death, the code is below:
Top of script:
After Typed /accept death:
Timer used above:
The problem is, the first time you use the command, it works-.. but if you use it again the text draw will not hide, it will stay black as appose to the first time where it hid it once the timer was done.
Top of script:
pawn Код:
new Text:blackTD;
pawn Код:
else if(!strcmp(params, "death", true))
{
if(!Injured[playerid]) return SendClientMessage(playerid, COLOR_GREY, "You are not injured.");
FMDAcceptedBy[playerid] = 0;
FMDAccepted[playerid] = 0;
Injured[playerid] = 0;
KillTimer(death_timer[playerid]);
KillTimer(injured_timer[playerid]);
SendClientMessage(playerid, COLOR_GREY, "You have blacked out. You're currently undergoing hospital treatment.");
SendClientMessage(playerid, COLOR_WHITE, "You will be released when you have recovered."); //trek
blackTD = TextDrawCreate(-20.000000,2.000000,"|");
TextDrawUseBox(blackTD,1);
TextDrawBoxColor(blackTD,0x000000ff);
TextDrawTextSize(blackTD,660.000000,22.000000);
TextDrawAlignment(blackTD,0);
TextDrawBackgroundColor(blackTD,0x000000ff);
TextDrawFont(blackTD,3);
TextDrawLetterSize(blackTD,1.000000,52.200000);
TextDrawColor(blackTD,0x000000ff);
TextDrawSetOutline(blackTD,1);
TextDrawSetProportional(blackTD,1);
TextDrawSetShadow(blackTD,1);
TextDrawShowForPlayer(playerid, blackTD);
SpawnChar(playerid);
SetPlayerPos(playerid, 1607.3260,1816.8665,10.8203);
TogglePlayerControllable(playerid, 0);
SetPlayerHealth(playerid, 100);
SetPlayerArmour(playerid, 0);
SetTimerEx("ToggleAcceptDeath", 8000, false, "i", playerid);
return 1;
}
return 1;
}
pawn Код:
forward ToggleAcceptDeath(playerid);
public ToggleAcceptDeath(playerid)
{
SendClientMessage(playerid, COLOR_GREY, "---------------------------------------------------------");
SendClientMessage(playerid, COLOR_LIGHTRED, "You where charged $250 for your medical bill.");
SendClientMessage(playerid, COLOR_GREY, "You lost 30 minutes memory due to your death to prevent Revenge Kills.");
SendClientMessage(playerid, COLOR_GREY, "---------------------------------------------------------");
ResetDodWeapons(playerid);
GiveDodMoney(playerid, -250);
TogglePlayerControllable(playerid, 1);
TextDrawHideForPlayer(playerid, blackTD);
return 1;
}