Execute command before client quits

This is the development community to discuss tribes mod coding or to ask questions.

Moderator: Moderators

1 Wed Mar 06, 2013 7:58 pm

I would like to push statistics to a database before the client quits the game.
To achieve this I thought I'd use Client::leaveGame(%clientId).

However, I can't access the client anymore since it's already gone when that function is called.

Is there any way I can execute a command accessing the specific client before it leaves the server?

Thanks in advance :)
tompb
Spambot in training
Spambot in training
 
Posts: 6

2 Thu Mar 07, 2013 7:42 am

Depending on what you want to track you could just build a global array using the player's name as the key identifier and track everything real time.
ProtoManX
Commander
Commander
 
Posts: 790

3 Thu Mar 07, 2013 10:57 am

look in server.cs for the onDisconnect function and use that
bawb
Commander
Commander
 
Posts: 1203

4 Thu Mar 07, 2013 3:54 pm

bawb wrote:look in server.cs for the onDisconnect function and use that


That is clientside man...
He wants serverside.
User avatar
C--
Sorry....
 
Posts: 3299

5 Thu Mar 07, 2013 5:42 pm

the server calls Server::onClientDisconnect(%clientId)
bugs_
1st Lieutenant
1st Lieutenant
 
Posts: 303

6 Fri Mar 08, 2013 4:08 am

Server::onClientDisconnect(%clientId) did the job for me, thanks a lot. :)
tompb
Spambot in training
Spambot in training
 
Posts: 6

7 Sun Mar 10, 2013 8:13 am

whatcha makin tom?
User avatar
Nim Ayanami
your mom is primeth
 
Posts: 635

8 Sun Mar 10, 2013 12:23 pm

Statistics script for the Paintball mod, it's pretty simple. A user is identified by a unique identification phrase in the "Other Infos" field (didn't want it to be name or IP-bound) and statistics are pushed to a MySQL database on mission change or when the user disconnect. Works quite well so far but I'm still improving a few performance things. :)

http://tribespb.net/stats.php
tompb
Spambot in training
Spambot in training
 
Posts: 6

9 Sun Mar 10, 2013 2:32 pm

loving sweet tom :D
User avatar
Ghost
2nd Lieutenant
2nd Lieutenant
 
Posts: 94

10 Thu Mar 21, 2013 6:50 am

thats awsome tom!
User avatar
Nim Ayanami
your mom is primeth
 
Posts: 635


Return to Coder's Hangout

Who is online

Users browsing this forum: Google [Bot] and 1 guest

cron