Online Players with Recorder.
#1

Hello, i was want to asking how to make an recorder for server which including TextDraw not msgs Clients , so if players was 15 and got 16 the new record will be 16 , and also showing online players: Online Players: %d


Shortly , When you connect to a server or a new record shows the maximum recorded number of players TextDraw Under the Money of the Game

I got this but its not with textdraw i failed to make an textdraw
CODE:
Код:
/*
Online Players Record v2 by AirKite
*/
#include <a_samp>
new oplayers, Precord, Drecord, Mrecord, Yrecord, THrecord, TMrecord;
new mname[][] = {"January", "February", "March", "April", "May", "June", "July", "Augusta", "September", "Otktyabrya", "November", "December"};
public OnFilterScriptInit()
{
	LoadRecord();
	oplayers=ConnectedPlayers();
	print("\n--------------------------------------");
	print("FS =Online Players Record= by Airkite, Loaded...");
	print("--------------------------------------\n");
	return 1;
}
public OnFilterScriptExit()
{
    print("\n--------------------------------------");
	print("FS =Online Players Record= by Airkite, Unloaded...");
	print("--------------------------------------\n");
	return 1;
}
public OnPlayerConnect(playerid)
{
	if(IsPlayerNPC(playerid)) { return 1; }
	SetTimerEx("Record", 5000, false, "d", playerid);
	return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
    oplayers--;
	return 1;
}
///////////////////////////////////////////////////////////////////////////
forward LoadRecord();
public LoadRecord()
{
	new strFromFile[24], arrCoords[6][5], File: file = fopen("porecords", io_read);
	if (file)
	{
		fread(file, strFromFile);
		split(strFromFile, arrCoords, ',');
		Precord = strval(arrCoords[0]);
		Drecord = strval(arrCoords[1]);
		Mrecord = strval(arrCoords[2]);
		Yrecord = strval(arrCoords[3]);
		THrecord = strval(arrCoords[4]);
		TMrecord = strval(arrCoords[5]);
		fclose(file);
	}
	return 1;
}
forward SaveRecord();
public SaveRecord()
{
	new coordsstring[24];
	format(coordsstring, sizeof(coordsstring), "%d,%d,%d,%d,%d,%d", Precord, Drecord, Mrecord, Yrecord, THrecord, TMrecord);
	new File: file = fopen("porecords", io_write);
	fwrite(file, coordsstring);
	fclose(file);
	return 1;
}
forward Record(playerid);
public Record(playerid)
{
	if(Precord)
	{
		new string[92];
		format(string, sizeof(string), "**Record for online players %d, fixed on %d %s %d, at %d:%d", Precord, Drecord, mname[Mrecord-1], Yrecord, THrecord, TMrecord);
		SendClientMessage(playerid, 0xA5D24DFF, string);
	}
	oplayers++;
    if(Precord < oplayers)
    {
        Precord=oplayers;
        gettime(THrecord, TMrecord); getdate(Yrecord, Mrecord, Drecord);
        new string[92];
		format(string, sizeof(string), "*New record for online players %d, fixed on %d %s %d, at %d:%d", Precord, Drecord, mname[Mrecord-1], Yrecord, THrecord, TMrecord);
        SendClientMessageToAll(0xFCB833FF, string);
        SaveRecord();
    }
	return 1;
}
stock split(const strsrc[], strdest[][], delimiter)
{
    new i, li;
    new aNum;
    new len;
    while(i <= strlen(strsrc))
    {
        if(strsrc[i] == delimiter || i == strlen(strsrc))
        {
            len = strmid(strdest[aNum], strsrc, li, i, 128);
            strdest[aNum][len] = 0;
            li = i+1;
            aNum++;
        }
        i++;
    }
    return 1;
}
forward ConnectedPlayers();
public ConnectedPlayers()
{
	new Connected;
	for(new i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && !IsPlayerNPC(i)) Connected++;
	return Connected;
}
///////////////////////////////////////////////////////////////////////////
Thanks, +Reps!
Reply
#2

https://sampwiki.blast.hk/wiki/TextDrawSetString
Reply
#3

Not helped me brother, I need a code. btw + rep
Reply
#4

What do you want to save in file?

Name?
Connect / Disconect date?
Players online?
Reply
#5

When you connect to a server or a new record shows the maximum recorded number of players TextDraw Under the Money of the Game
Reply
#6

Anyone can help?
Reply
#7

new Online, Text: OnPlayers, Online_txt[64], File: On_txt, On_File_txt[32], Max_Online;

public OnGameModeInit()
{
On‌line=0;
Max_Online=0;
On‌Players=TextDrawCreate(450,0,"~y~Players Online: ~r~0~n~~y~Max Players Online: ~r~0");
TextDrawSetShadow(OnPlayers,0);
TextDrawUseBox(OnPlayers,1);
TextDrawBoxColor(OnPlayers,0x000000FF);
return 1;
}

public OnPlayerConnect(playerid)
{
On_txt=fopen("Max_Online.txt",io_readwrite);
fread(On_txt,On_File_txt,32,false);
fclose(On_txt);
Max_Online=strval(On_File_txt);
On‌line=Online+1;
if(Online>Max_Online)
{
On_txt=fopen("Max_Online.txt",io_readwrite);
format(On_File_txt,32,"%i",Online);
fwrite(On_txt,On_File_txt);
fclose(On_txt);
}
format(Online_txt,64,"~y~Players Online: ~r~%i~n~~y~Max Players Online: ~r~%i",Online,Max_Online);
TextDrawHideForAll(OnPlayers);
TextDrawSetString(OnPlayers,Online_txt);
TextDrawShowForAll(OnPlayers);
return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
On‌line=Online-1;
format(Online_txt,64,"~b~Players Online: ~r~%i~n~~y~Max Players Online: ~r~%i",Online,Max_Online);
TextDrawHideForAll(OnPlayers);
TextDrawSetString(OnPlayers,Online_txt);
TextDrawShowForAll(OnPlayers);
return 1;
}

public OnGameModeExit()
{
TextDrawDestroy(OnPlayers);
return 1;
}
Reply
#8

Is that tested bro?
Reply
#9

Quote:
Originally Posted by MahdiGames
Посмотреть сообщение
Is that tested bro?
Quote:

Not helped me brother, I need a code. btw + rep

Wtf, expect us to do everything? You might as well just download your whole server.

^^ and now if you want to rep- me go ahead.
Reply
#10

Quote:
Originally Posted by ic3cr3am
Посмотреть сообщение
Wtf, expect us to do everything? You might as well just download your whole server.

^^ and now if you want to rep- me go ahead.
if you wont do it so dont reply , no more reps from people..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)