25.02.2013, 19:38
Ok, so
1. Remove everthing from OnGameModeInit, and remove Textdraw0 variable
1. Remove everthing from OnGameModeInit, and remove Textdraw0 variable
pawn Код:
//Global variables
static Timers[MAX_PLAYERS];
static Text:Textdraw0[MAX_PLAYERS] = { Text:INVALID_TEXT_DRAW, ... };
//OnPlayerDeath
PlayerInfo[playerid][pDeadTimer] = 60;
if(Text:Textdraw0[playerid] == Text:INVALID_TEXT_DRAW) DrawStuff(Textdraw0[playerid]);
TextDrawShowForPlayer(playerid, Textdraw0[playerid]);
Timers[playerid] = SetTimerEx("DeathTimer", XXX, "i", playerid);
//Later
public DeathTimer(playerid)
{
if(PlayerInfo[playerid][pDead] == 1){
if(PlayerInfo[playerid][pDeadTimer] == 0){
KillTimer(Timers[playerid]);
PlayerInfo[playerid][pDead] = 0;
SpawnPlayer(playerid);
GivePlayerMoney(playerid, 100);
SendClientMessage(playerid, COLOR_LIGHTBLUE, "You died, remember that you can't remember getting killed.!");
TextDrawHideForPlayer(playerid, Textdraw0[playerid]);
}
else if(PlayerInfo[playerid][pDeadTimer] < 61){
if(PlayerInfo[playerid][pDeadAnim] == 1)
{
PlayerInfo[playerid][pDeadAnim] = 0;
TogglePlayerControllable(playerid,false);
ApplyAnimation(playerid,"CRACK","crckdeth2",4.1,0,1,1,1,0,1);
}
PlayerInfo[playerid][pDeadTimer]--;
new string[128];
format(string,sizeof(string),"Time until \nrespawn:\n%d seconds",PlayerInfo[playerid][pDeadTimer]);
TextDrawShowForPlayer(playerid, Textdraw0[playerid]);
TextDrawSetString(Textdraw0[playerid], string);
}
}
}
stock DrawStuff(&Text:td) {
td = TextDrawCreate(557.000000, 120.000000, "_");
TextDrawAlignment(td, 2);
TextDrawBackgroundColor(td, 255);
TextDrawFont(td, 1);
TextDrawLetterSize(td, 0.440000, 1.600000);
TextDrawColor(td, -16776961);
TextDrawSetOutline(td, 1);
TextDrawSetProportional(td, 1);
TextDrawUseBox(td, 1);
TextDrawBoxColor(td, 255);
TextDrawTextSize(td, 50.000000, 150.000000);
}