Dedicated server callbacks?

Moderator: NADEO

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

Re: Dedicated server callbacks?

Post by adder »

Thanks :D
User avatar
adder
Posts: 138
Joined: 06 May 2012, 17:34
Location: Belgium

:?:

Post by adder »

Little question again :)

how do i stop this from happening
http://i.imgur.com/IZtex.jpg
(the time is not displayed as 25.000 but as 25.)

Code: Select all

$seconds = $playerfinish['timee'] / 1000;
$minutes = floor($playerfinish['timee'] / (1000 * 60));
The_Big_Boo
Posts: 1026
Joined: 15 Jun 2010, 15:46

Re: Dedicated server callbacks?

Post by The_Big_Boo »

It's more a problem with what you do to change numbers to string than the code you gave. Anyway, you can copy/paste the code here to get a string from a time in milliseconds: http://code.google.com/p/manialive/sour ... s/Time.php
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
User avatar
adder
Posts: 138
Joined: 06 May 2012, 17:34
Location: Belgium

Re: Dedicated server callbacks?

Post by adder »

thanks ;)
User avatar
adder
Posts: 138
Joined: 06 May 2012, 17:34
Location: Belgium

Re: Dedicated server callbacks?

Post by adder »

Hey! :)

Need some help with the structures the server sends back
I've been trying for 2 days and I really don't get it to work :oops:

imagine I send this request:
GetCurrentMapInfo
struct GetCurrentMapInfo()
Returns a struct containing the infos for the current map
I have this code:

Code: Select all

       $mapinfocb = $connect->query('GetCurrentMapInfo');
	$mapinfo = unpack('CName/CUid/CFilename/CAuthor/CEnvironnement/CMood/CBronzeTime/CSilverTime/CGoldTime/CAuthortime/CCopperprice/CLapRace/CNbLaps/CNbCheckpoints',$mapinfocb[0]);
	$currmapname = $mapinfo['Name'];
	$currmapuid = $mapinfo['Uid'];
	$connect->query('ChatSendServerMessage',"$currmapname id= $currmapuid");
But is get this warning:
Warning: unpack() [function.unpack]: Type C: not enough input (need 1, have 0) in Y/... on line ...

:|
Last edited by adder on 19 May 2012, 13:07, edited 1 time in total.
The_Big_Boo
Posts: 1026
Joined: 15 Jun 2010, 15:46

Re: Dedicated server callbacks?

Post by The_Big_Boo »

Why are you calling unpack? unpack is used only to get the size of the response (which is done by your query method I presume). Dedicated server is using XML-RPC so queries and responses are in XML, not in a packed string. And anyway, you can't get anything with this format as you're using only C (an unsigned char) for strings and integers. :?

What is returned by your query method? Use print_r() on it to be sure.
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
User avatar
adder
Posts: 138
Joined: 06 May 2012, 17:34
Location: Belgium

Re: Dedicated server callbacks?

Post by adder »

The_Big_Boo wrote:Why are you calling unpack? unpack is used only to get the size of the response
Ow... big fail of me :shock:

But then, how do i get the "GetCurrentMapInfo" info?
because i had this:

Code: Select all

$mapinfocb = $connect->query('GetCurrentMapInfo');
$currmapname = $mapinfocb[0];
$currmapuid = $mapinfocb[1];
$connect->query('ChatSendServerMessage',"$currmapname id= $currmapuid"); 
//this sends a chat message for testing, so i know what the content of $currmapname is
and it gave empty variables
The_Big_Boo
Posts: 1026
Joined: 15 Jun 2010, 15:46

Re: Dedicated server callbacks?

Post by The_Big_Boo »

So your query method is apparently returning an array. Then the keys should be strings and your code should be more like this:

Code: Select all

$currmapname = $mapinfocb['Name'];
$currmapuid = $mapinfocb['Uid'];
To be sure, call print_r($mapinfocb), you'll know exactly what's the return.
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
User avatar
adder
Posts: 138
Joined: 06 May 2012, 17:34
Location: Belgium

Re: Dedicated server callbacks?

Post by adder »

the return is 1
The_Big_Boo wrote:So your query method is apparently returning an array.
It should return a struct
BTW: thanks a lot for helping me :1010

EDIT:
i've got it working

Code: Select all

$connect->query('GetCurrentMapInfo');
$mapinfocb = $connect->getResponse();
print_r($mapinfocb);
returns this http://i.imgur.com/RBi8H.jpg

the client already changes $mapinfocb[0] into $mapinfocb['UId'], [1] into ['Name'], ...
so $mapinfocb[0] doesn't exists, and therefor is 0.
:roflol:
User avatar
adder
Posts: 138
Joined: 06 May 2012, 17:34
Location: Belgium

Re: Dedicated server callbacks?

Post by adder »

New question :mrgreen:

Imagine a have this file alreadyvotedplus.list
alreadyvote.list wrote:adder
otherlogin
ilikebananas
login
I want that if a login is inside this file, it should be removed.
I know how to check if its in the file:

Code: Select all

...$alreadyvote = file("inc\Lists\vote\\".$mapinfocb['UId']."plus.list");
array_walk($alreadyvote, 'trim_value'); // use function: trim_value to "clean" the file
if (in_array(...
so if "in_array" returns true, i want to remove it from the array

Thanks in advance
Post Reply

Return to “Dedicated Server”

Who is online

Users browsing this forum: No registered users and 0 guests