[RELEASE]Real player counter with quest

01/03/2015 03:01 MT2SRV#1
Hey there.
I would like you, then I say that his first work.

Quest and I wrote a database with the help of a simple quest :)

Is to find out exactly determine when a game is up

Code:
quest status begin
    state start begin
        when login begin
	local mysql_user = "mt2"
	local mysql_pw = "metin2"
	local player_id = tonumber(pc.get_player_id())
	local status = 1 
	local mysql_query = "UPDATE player.player SET status ="..status.." WHERE id = "..player_id..";"
	os.execute("mysql --host=localhost --user="..mysql_user.." --password="..mysql_pw.." --execute='"..mysql_query.."'")
	chat("Log In")
	end
		when logout begin
	local mysql_user = "mt2"
	local mysql_pw = "metin2"
	local player_id = tonumber(pc.get_player_id())
	local status = 0
	local mysql_query = "UPDATE player.player SET status ="..status.." WHERE id = "..player_id..";"
	os.execute("mysql --host=localhost --user="..mysql_user.." --password="..mysql_pw.." --execute='"..mysql_query.."'")
	chat("Log Out")
	end
    end
end

Oh, and to give the player the status of a table column named integer type ;)

Sorry about Google Translate :S

Happy new year EPVP :3
01/03/2015 06:04 *Denis*#2
It can cause performance problems, because each time someone logins or logouts the quest executes a query.
01/03/2015 10:44 .Shōgun#3
The real player count is in the file db/usage.txt or you can fetch it with the web api like WoM does.

[Only registered and activated users can see links. Click Here To Register...]
01/03/2015 12:58 MT2SRV#4
Quote:
Originally Posted by .Shōgun View Post
The real player count is in the file db/usage.txt or you can fetch it with the web api like WoM does.

[Only registered and activated users can see links. Click Here To Register...]

Problem is P2P ports ... :3

Quote:
Originally Posted by *Denis* View Post
It can cause performance problems, because each time someone logins or logouts the quest executes a query.

My VPS :

Ram : 4Gb
HDD :45Gb
CPU : 4 Cores
Mysql verzion : 5.5 + fastmx and full calibrate a vps.
01/03/2015 13:53 .Shōgun#5
Quote:
Originally Posted by MT2SRV View Post
Problem is P2P ports ... :3
I don't understand what you mean. You have to set ADMINPAGE_IP and ADMINPAGE_PASSWORD to authenticate when using the Web API, that's all. And yeah your P2P must be working of course.
01/03/2015 16:41 Alergix2#6
Nice very Usefull!
01/03/2015 16:42 clad3815#7
Quote:
Originally Posted by .Shōgun View Post
The real player count is in the file db/usage.txt or you can fetch it with the web api like WoM does.

[Only registered and activated users can see links. Click Here To Register...]
You really need do promotion of your game on every post you do ? Not only you use this method. :handsdown:

If you use WEB API directly on your website without cache system, that is same than do a query
01/03/2015 17:02 MT2SRV#8
I think just the quest basis :)

It's just an Update query is me .... I is extended with an INSERT INTO na and very hard to use SQL :)

But thank you, at least some people like it.

The problem is that many in Hungary is crippled, and I do not dare to P2P is at risk

Sory bad english :/
01/03/2015 17:12 Sanchez_x#9
Quote:
Originally Posted by clad3815 View Post
You really need do promotion of your game on every post you do ? Not only you use this method. :handsdown:

If you use WEB API directly on your website without cache system, that is same than do a query

The execution of USER_COUNT does not runs any query.
01/03/2015 17:25 Tuora#10
Usefull,thanks
01/03/2015 17:27 MT2SRV#11
Quote:
Originally Posted by Sanchez_x View Post
The execution of USER_COUNT does not runs any query.
It is absolutely true, but even P2P ... you know what you are crippled ... once you find out what the P2P port end ..: /

//////////////////////HU//////////
Teljesen igaz , de akkor is P2P ... tudod te is milyen nyomorékok vannak ... egyszer megtudja mi a P2P port akkor vége.. :/
01/03/2015 20:02 He3o Crysis#12
Quote:
Originally Posted by clad3815 View Post
You really need do promotion of your game on every post you do ? Not only you use this method. :handsdown:

If you use WEB API directly on your website without cache system, that is same than do a query

What is your problem?
Shogun did nothing wrong.
He pointed out that there is a better way to do this and mentioned an example (WOM).

Using the Web API is still more efficient than using a query directly to the database.
Another advantage is the higher accuracy. (last_play updates every 5m i think (?))

Yours faithfully,
Crysis
01/03/2015 20:25 MT2SRV#13
Quote:
Originally Posted by .He3o Crysis View Post
What is your problem?
Shogun did nothing wrong.
He pointed out that there is a better way to do this and mentioned an example (WOM).

Using the Web API is still more efficient than using a query directly to the database.
Another advantage is the higher accuracy. (last_play updates every 5m i think (?))

Yours faithfully,
Crysis

\___________/ < Cry box :3

This is a solution that I showed you do not have reason to wage war :): D
01/04/2015 03:46 Noa_#14
u can use flags to
01/04/2015 09:36 .Shōgun#15
Quote:
Originally Posted by .He3o Crysis View Post
What is your problem?
Shogun did nothing wrong.
He pointed out that there is a better way to do this and mentioned an example (WOM).
He works for sg, that's his problem.

Quote:
Originally Posted by .He3o Crysis View Post
Using the Web API is still more efficient than using a query directly to the database.
Another advantage is the higher accuracy. (last_play updates every 5m i think (?))

Yours faithfully,
Crysis
The last_play query just doesn't make any sense, but it gives a higher playercount than real (and you can stretch it even further by changing the interval) so most people don't really want to use the proper way. I see every day servers with less people than ours claiming to have 1000 or 2000 online at the same time.