SA-MP Forums Archive
Textdraw countdown for certain player - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Textdraw countdown for certain player (/showthread.php?tid=202189)



Textdraw countdown for certain player - BlackWolf120 - 23.12.2010

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?

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;
}



Re: Textdraw countdown for certain player - Gavibro - 23.12.2010

SetTimerEx("Spectateafterdeathend", 6000, 0,"e",playerid);
e = ? lol,it's i or d
Because e it's ..empty? function it's called just for playerid 0.


Re: Textdraw countdown for certain player - BlackWolf120 - 23.12.2010

thx lol didnt see that
how to do it like the textdraw countdown is only displayed to the killed person and not also to the killer?