SA-MP Forums Archive
Please help with players online counter - 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: Please help with players online counter (/showthread.php?tid=81694)



Please help with players online counter - AiVAMAN - 13.06.2009

Click here to see my code

So, I decided to make Players Online counter in TextDraw.

I get no errors, but textDraw won't show.. please help me? I am Really stuck at this.


Re: Please help with players online counter - miokie - 13.06.2009

TextDrawShowForPlayer/All
TextDrawSetString

?


Re: Please help with players online counter - AiVAMAN - 13.06.2009

What TextDrawSetString is used for? i have set TextDrawShowForPlayer on PlayerConnect


Re: Please help with players online counter - [NL]Bank - 13.06.2009

http://pastebin.com/m60894c48
Here.


Re: Please help with players online counter - CracK - 13.06.2009

There is no reason to make a timer here.
pawn Код:
#include <a_samp>

new Text:Online;
new PlayersOnline;
new string[100];

public OnFilterScriptInit()
{
  for(new i;i<MAX_PLAYERS;i++)
    if(IsPlayerConnected) PlayersOnline++;
  Online = TextDrawCreate(498.000000, 101.000000, string);
  TextDrawAlignment(Online,0);
  TextDrawBackgroundColor(Online,0x000000ff);
  TextDrawFont(Online,1);
  TextDrawLetterSize(Online,0.299999,1.000000);
  TextDrawColor(Online,0xffffffff);
  TextDrawSetOutline(Online,1);
  TextDrawSetProportional(Online,1);
  TextDrawSetShadow(Online,1);
  format(string,sizeof(string),"~w~Players ~g~Online~w~: %i", PlayersOnline);
  return 1;
}

public OnPlayerConnect(playerid)
{
  PlayersOnline++;
  format(string,sizeof(string),"~w~Players ~g~Online~w~: %i", PlayersOnline);
  TextDrawSetString(Online,string);
  TextDrawShowForPlayer(playerid, Online);
  return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
  PlayersOnline--;
  format(string,sizeof(string),"~w~Players ~g~Online~w~: %i", PlayersOnline);
  TextDrawSetString(Online,string);
  return 1;
}
public OnFilterScriptExit()
{
  TextDrawDestroy(Online);
  return 1;
}



Re: Please help with players online counter - [NL]Bank - 13.06.2009

Why not?
He will update the PLAYER TEXTDRAW for the %d. :P


Re: Please help with players online counter - CracK - 13.06.2009

TextDrawString is used in OnPlayerConnect and OnPlayerDisconnect


Re: Please help with players online counter - [NL]Bank - 13.06.2009

oeps, is was forget that ;P
Sorry xD