Dedicated server callbacks?

Moderator: NADEO

User avatar
adder
Posts: 141
Joined: 06 May 2012, 17:34
Location: Belgium

Dedicated server callbacks?

Post by adder » 06 May 2012, 20:32

Hey all :D
I'm trying to make a server controller :gobananas:
Its my first ever try to write a php file
(actualy the first time i program xD)

Now i have a problem:

I can fully connect to the server and send message's and stuff , BUT
is there a list of call backs i can recieve from the server?
I've already looked inside the FOXcontrol file but i can't understand them

i'm looking for thing like:

TrackMania.PlayerConnect

Is there a list of all available call-backs ?

thanks in advance :clap:

TheM
Posts: 1445
Joined: 15 Jun 2010, 14:30
Location: Uden, Noord-Brabant, Netherlands
Contact:

Re: Dedicated server callbacks?

Post by TheM » 06 May 2012, 20:55

Global moderator | Dutch moderator | Laddermoderator | ManiaWiki moderator
Server Manager/webmaster of Smurfen.net, join us on Canyon, Valley and Royal!
ESL (Game) Staff Head for TrackMania (Stadium, Canyon and Valley).

User avatar
Slig
Posts: 637
Joined: 15 Jun 2010, 11:52
Location: TraXicoLand

Re: Dedicated server callbacks?

Post by Slig » 07 May 2012, 15:35

You have also a simple script in http://www.xaseco.org/downloads/rpc_utilities.zip : callbacks.php, which can help your first steps, showing easily all dedicated callbacks and so help to understand them.

User avatar
adder
Posts: 141
Joined: 06 May 2012, 17:34
Location: Belgium

Re: Dedicated server callbacks?

Post by adder » 07 May 2012, 15:57

Thanks very much guys :yes:

User avatar
adder
Posts: 141
Joined: 06 May 2012, 17:34
Location: Belgium

Re: Dedicated server callbacks?

Post by adder » 07 May 2012, 19:51

Hello!
I need a little help
i have this code:

Code: Select all

$connect->query('EnableCallbacks', true);

$connect->readCB(0);
$callbacks = $connect->getCBResponses();

	foreach ($callbacks as $cb) {
			if ($cb[0] == 'TrackMania.PlayerFinish') {
			$cb[1] = $playerfinish['nickname'];
			$cb[2] = $playerfinish['login'];
			$cb[3] = $playerfinish['timee'];
			$connect->query('ChatSendServerMessage', '$z$fffPlayer $f00'.$playerfinish['nickname'].'$fff('.$playerfinish['login'].'$fff) Drove this time: $f00'.$playerfinish['timee'].'$fff!');
		}
}
and the only thing i get is this: http://imgur.com/WfWIJ
empty variables.

thanks in advance :thumbsup:

The_Big_Boo
Posts: 1041
Joined: 15 Jun 2010, 15:46

Re: Dedicated server callbacks?

Post by The_Big_Boo » 07 May 2012, 20:06

You've inverted assignments between $playerfinish array and $cb array. This should work: ;)

Code: Select all

$playerfinish['nickname'] = $cb[1];
$playerfinish['login'] = $cb[2];
$playerfinish['timee'] = $cb[3];
Edit: well, even with this you won't have what you're expecting to have, because $cb[1] is an integer identifying the player, not his nickname. You have to query the server to get nicknames.
OS: Win 7 Pro x64
RAM: 2x4GB Corsair @ 1600MHz
CPU: Intel i5 760 @ 3.6GHz
Mobo: Asus P7P55D-E
GPU: NVidia GTX 760 2GB
HDD: WD Black 1TB
Sound: VIA VT1828S (onboard)
Peripherals: Razer DeathAdder - Razer DeathStalker - Logitech F310

svens
Posts: 100
Joined: 15 Jun 2010, 11:06
Location: Bern, CH
Contact:

Re: Dedicated server callbacks?

Post by svens » 07 May 2012, 20:08

adder wrote:

Code: Select all

	foreach ($callbacks as $cb) {
			if ($cb[0] == 'TrackMania.PlayerFinish') {
			$playerfinish['nickname'] = $cb[1];
			$playerfinish['login']  = $cb[2];
			$playerfinish['timee'] = $cb[3];
			$connect->query('ChatSendServerMessage', '$z$fffPlayer $f00'.$playerfinish['nickname'].'$fff('.$playerfinish['login'].'$fff) Drove this time: $f00'.$playerfinish['timee'].'$fff!');
		}
}
Your assignments are in the wrong order. Use "var_dump()" to see the contents of a variable (or http://xdebug.org/docs/remote if you have acces to that).

User avatar
adder
Posts: 141
Joined: 06 May 2012, 17:34
Location: Belgium

Re: Dedicated server callbacks?

Post by adder » 12 May 2012, 16:31

Hello!

I've got a little question (its nothing really important)

I have this file "admins.list", and its a list off all admin logins. this is the list:

Code: Select all

login
login2
adder
otherlogin
when i load this file into an array "$isadmin"
and perform an IN_ARRAY check like this:

Code: Select all

if (in_array($playerchat['login'], $isadmin)) {
it doesn't work. But with this: it does

Code: Select all

if (in_array($playerchat['login']."\r\n", $isadmin)) {
why is this ?

User avatar
Xymph
Posts: 1399
Joined: 15 Jun 2010, 20:35
Contact:

Re: Dedicated server callbacks?

Post by Xymph » 12 May 2012, 16:47

You're working on Windows, on Linux you'd just need to append "\n". ;)
But that's beside the point, you need to trim the lines that are read from the file before storing them in the array.
Developer of XASECO for TMF/TMN ESWC & XASECO2 for TM²: see XAseco.org
Find your way around the Mania community from the TMN ESWC hub, TMF hub, TM² hub, and SM hub

User avatar
magnetik
Nadeo
Nadeo
Posts: 1676
Joined: 01 Feb 2012, 19:13
Location: Bordeaux
Contact:

Re: Dedicated server callbacks?

Post by magnetik » 12 May 2012, 17:13

It depends on how you load the admin list into your script.
ManiaPlanet technical documentation portal (Dedicated, ManiaLink, ManiaScript, Titles...) -- contribute!

Post Reply

Return to “Dedicated Server”

Who is online

Users browsing this forum: No registered users and 1 guest