23.12.2010, 14:29
hi,
the problem is the countdown textdraw. For the first player it works fine but after there are more players on the server, only one player sees the countdown. How to fix this?
the problem is the countdown textdraw. For the first player it works fine but after there are more players on the server, only one player sees the countdown. How to fix this?
pawn Код:
forward counterrespawning(playerid);
new countdownrespawn = 6;
new CRESDisable;
//OnGameModeInit
MiniCountdownrespawn = TextDrawCreate(3.000000, 412.000000, "6");
TextDrawBackgroundColor(MiniCountdownrespawn, 255);
TextDrawFont(MiniCountdownrespawn, 3);
TextDrawLetterSize(MiniCountdownrespawn, 0.939999, 3.900000);
TextDrawColor(MiniCountdownrespawn, -1);
TextDrawSetOutline(MiniCountdownrespawn, 1);
TextDrawSetProportional(MiniCountdownrespawn, 1);
TextDrawUseBox(MiniCountdownrespawn, 1);
TextDrawBoxColor(MiniCountdownrespawn, 1684300900);
TextDrawTextSize(MiniCountdownrespawn, 41.000000, 0.000000);
//OnTheBottomOfScript
forward Spectateafterdeathstart(playerid,killerid);
forward Spectateafterdeathend(playerid);
//This function is called after a player dies
public Spectateafterdeathstart(playerid,killerid)
{
TogglePlayerSpectating(playerid,1); //playerid sees killerid for 6 secs
PlayerSpectatePlayer(playerid,killerid,SPECTATE_MODE_NORMAL);
SetTimerEx("Spectateafterdeathend", 6000, 0,"e",playerid);
counterrespawning(playerid);
GameTextForPlayer(playerid, "~r~Respawning...", 6000, 3);
return 1;
}
public Spectateafterdeathend(playerid) //this ends the spectating
{
TogglePlayerSpectating(playerid,0);
KillTimer(CRESDisable);
countdownrespawn = 6;
TextDrawHideForPlayer(playerid,MiniCountdownrespawn);
return 1;
}
public counterrespawning(playerid)
{
if(countdownrespawn > 0)//this is the texdraw countdown counting backwards from 6 secs so the player knows wen hes gonna spawn
{
CRESDisable = SetTimer("counterrespawning",990,false);
new textformat[85];
format(textformat,sizeof textformat,"~r~%d",countdownrespawn);
TextDrawSetString(MiniCountdownrespawn,textformat);
TextDrawShowForPlayer(playerid,MiniCountdownrespawn);
countdownrespawn --;
}
return 1;
}