Page 2 of 4

Re: Dedicated server callbacks?

Posted: 12 May 2012, 17:48
by adder
Thanks :D

:?:

Posted: 13 May 2012, 20:02
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));

Re: Dedicated server callbacks?

Posted: 13 May 2012, 21:29
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

Re: Dedicated server callbacks?

Posted: 14 May 2012, 15:40
by adder
thanks ;)

Re: Dedicated server callbacks?

Posted: 19 May 2012, 12:35
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 ...

:|

Re: Dedicated server callbacks?

Posted: 19 May 2012, 12:58
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.

Re: Dedicated server callbacks?

Posted: 19 May 2012, 13:06
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

Re: Dedicated server callbacks?

Posted: 19 May 2012, 13:22
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.

Re: Dedicated server callbacks?

Posted: 19 May 2012, 13:32
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:

Re: Dedicated server callbacks?

Posted: 20 May 2012, 18:33
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