Please help with players online counter
#1

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.
Reply
#2

TextDrawShowForPlayer/All
TextDrawSetString

?
Reply
#3

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

http://pastebin.com/m60894c48
Here.
Reply
#5

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;
}
Reply
#6

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

TextDrawString is used in OnPlayerConnect and OnPlayerDisconnect
Reply
#8

oeps, is was forget that ;P
Sorry xD
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)