public OnPlayerConnect(playerid)
{
format(string1, sizeof(string1), "%d", Iter_Count(Player));
PlayerTextDrawSetString(playerid, OnlineRecordTD[playerid][2], string1);
return 1;
}
|
Make it a global textdraw, This function will change the textdraw string ONLY for the player that have joined.
|
new PlayersOnline; //global
public OnPlayerConnect(playerid)
{
new string2[5];
PlayersOnline ++;
format(string2, sizeof(string2), "%d%", PlayersOnline);
TextDrawSetString(OnlineRecordTD[2], string2);
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
PlayersOnline --;
format(string2, sizeof(string2), "%d%", PlayersOnline);
TextDrawSetString(OnlineRecordTD[2], string2);
return 1;
}
OnlineRecordTD[2] = TextDrawCreate(112.666671, 290.551269, "1000");
TextDrawLetterSize(OnlineRecordTD[2], 0.400000, 1.600000);
TextDrawAlignment(OnlineRecordTD[2], 1);
TextDrawColor(OnlineRecordTD[2], 16777215);
TextDrawSetShadow(OnlineRecordTD[2], 0);
TextDrawSetOutline(OnlineRecordTD[2], 0);
TextDrawBackgroundColor(OnlineRecordTD[2], 255);
TextDrawFont(OnlineRecordTD[2], 1);
TextDrawSetProportional(OnlineRecordTD[2], 1);
TextDrawSetShadow(OnlineRecordTD[2], 0);
|
Make it a global textdraw, This function will change the textdraw string ONLY for the player that have joined.
|
new PlayersOnline;
public OnGameModeInit()
{
OnlineRecordTD[2] = TextDrawCreate(112.666671, 290.551269, "0");
TextDrawLetterSize(OnlineRecordTD[2], 0.400000, 1.600000);
TextDrawAlignment(OnlineRecordTD[2], 1);
TextDrawColor(OnlineRecordTD[2], 16777215);
TextDrawSetShadow(OnlineRecordTD[2], 0);
TextDrawSetOutline(OnlineRecordTD[2], 0);
TextDrawBackgroundColor(OnlineRecordTD[2], 255);
TextDrawFont(OnlineRecordTD[2], 1);
TextDrawSetProportional(OnlineRecordTD[2], 1);
TextDrawSetShadow(OnlineRecordTD[2], 0);
return 1;
}
public OnPlayerConnect(playerid)
{
if(!IsPlayerNPC(playerid))
{
new pcount[5];
valstr(pcount, ++PlayersOnline);
TextDrawSetString(OnlineRecordTD[2], pcount);
TextDrawShowForPlayer(playerid, OnlineRecordTD[2]);
}
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
if(!IsPlayerNPC(playerid))
{
new pcount[5];
valstr(pcount, --PlayersOnline);
TextDrawSetString(OnlineRecordTD[2], pcount);
}
return 1;
}