
Dedicated server callbacks?
Moderator: NADEO
:?:
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.)

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));
-
- Posts: 1026
- Joined: 15 Jun 2010, 15:46
Re: Dedicated server callbacks?
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
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
Re: Dedicated server callbacks?
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
imagine I send this request:
But is get this warning:
Warning: unpack() [function.unpack]: Type C: not enough input (need 1, have 0) in Y/... on line ...


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

imagine I send this request:
I have this code:GetCurrentMapInfo
struct GetCurrentMapInfo()
Returns a struct containing the infos for the current map
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");
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.
-
- Posts: 1026
- Joined: 15 Jun 2010, 15:46
Re: Dedicated server callbacks?
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.

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
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
Re: Dedicated server callbacks?
Ow... big fail of meThe_Big_Boo wrote:Why are you calling unpack? unpack is used only to get the size of the response

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
-
- Posts: 1026
- Joined: 15 Jun 2010, 15:46
Re: Dedicated server callbacks?
So your query method is apparently returning an array. Then the keys should be strings and your code should be more like this:
To be sure, call print_r($mapinfocb), you'll know exactly what's the return.
Code: Select all
$currmapname = $mapinfocb['Name'];
$currmapuid = $mapinfocb['Uid'];
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
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
Re: Dedicated server callbacks?
the return is 1
BTW: thanks a lot for helping me
EDIT:
i've got it working
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.

It should return a structThe_Big_Boo wrote:So your query method is apparently returning an array.
BTW: thanks a lot for helping me

EDIT:
i've got it working
Code: Select all
$connect->query('GetCurrentMapInfo');
$mapinfocb = $connect->getResponse();
print_r($mapinfocb);
the client already changes $mapinfocb[0] into $mapinfocb['UId'], [1] into ['Name'], ...
so $mapinfocb[0] doesn't exists, and therefor is 0.

Re: Dedicated server callbacks?
New question
Imagine a have this file alreadyvotedplus.list
I know how to check if its in the file:
so if "in_array" returns true, i want to remove it from the array
Thanks in advance

Imagine a have this file alreadyvotedplus.list
I want that if a login is inside this file, it should be removed.alreadyvote.list wrote:adder
otherlogin
ilikebananas
login
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(...
Thanks in advance
Who is online
Users browsing this forum: No registered users and 0 guests