[PHP] Clientless Silkroad Security + ServerStats

06/14/2011 22:08 pushedx#16
Quote:
Originally Posted by LastThief View Post
may i know what is this ?
You did not set the "host" parameter. See 'examples.txt' for more information about the parameters.

Quote:
Originally Posted by prot3ctor View Post
Array ( [0] => Error [1] => A connection could not be established. )
That means the Gateway Server you are connecting to is physically down or not accessible from your server (like jSRO on a non-jp IP). If you are sure it is up, then sockets may not be enabled for outgoing connections on your host (unlikely, but possible). Try with different hosts in 'examples.txt'.

Quote:
Originally Posted by inv123 View Post
My only prob that suddenly after some changes stats changed to ratios, hehe
Just multiple the ratio by 3500 before you display and round to a whole number. I provided the ratio in the code just because that's what is in the packet. It's the most 'accurate' to work with, so you can customize the final output if you want cur/max.

-

If you are having other troubles with the scripts, try getting a free host from [Only registered and activated users can see links. Click Here To Register...] and testing there. That's the test host I used and had no issues with it. Usually, it'll be a problem with how PHP is configured, but since a lot of places do it differently, there's no easy way to debug it with how PHP works. For reference, this is the [Only registered and activated users can see links. Click Here To Register...] from the test host.
06/15/2011 11:25 inv123#17
[Only registered and activated users can see links. Click Here To Register...]

Done after some hours :)
06/16/2011 00:13 lorveth#18
Ur the best drew, for real.
Keep up ur good work.

Edit: here got it working: [Only registered and activated users can see links. Click Here To Register...]
06/17/2011 03:05 Kape7#19
Quote:
Originally Posted by KingLi :P View Post
Ur the best drew, for real.
Keep up ur good work.

Edit: here got it working: [Only registered and activated users can see links. Click Here To Register...]
You will break the host if you show the stats to a large amount of users at the same time directly from the script, each user will run it and overload the host. The intention of this script is make a cronjob for update the stats into a DB or similar and show the result to the users, not make the users directly run the script.
06/17/2011 11:34 lesderid#20
Quote:
Originally Posted by Synx7 View Post
You will break the host if you show the stats to a large amount of users at the same time directly from the script, each user will run it and overload the host. The intention of this script is make a cronjob for update the stats into a DB or similar and show the result to the users, not make the users directly run the script.
Or if you don't have cronjobs on your host, you can check the last time it was checked and if it's too long, you do the script and put it in the DB, otherwise you just load it from the DB.
06/21/2011 20:10 inv123#21
Hmm so strange.
I tryed using the same hosting as edx, 000webhost. But it gave me an error, even if i just trying with the non-modifyed version :/

[Only registered and activated users can see links. Click Here To Register...]

Everything works smooth @ localhost, but i cant even make it work on remote hosts. So i cant understand how edx's stats working, and mine not :D
[Only registered and activated users can see links. Click Here To Register...]
06/24/2011 18:53 pushedx#22
Quote:
Originally Posted by inv123 View Post
Hmm so strange.
I tryed using the same hosting as edx, 000webhost. But it gave me an error, even if i just trying with the non-modifyed version :/
000webhost uses a bunch of different servers with different domain names. It's possible your site is being hosted on a different server that isn't setup the same as the others. I've already had one person mention similar issues with theirs, but there's not much you can do besides trying to find a different host, or trying to figure out what exactly why the configuration isn't working.
06/30/2011 16:55 S3cret#23
Hi Drew,
is it possible to gather information (iSro) about the maximum number of people who can join a server? Or is the only way to store it in an array and renew it each time a server changes or comes new?

Greets and really well done!
S3cret
06/30/2011 17:34 kevin_owner#24
The server stats of isro is just a decimal number in the packet so you don't really know how much people there are but since you know how full the server is you can calculate how much people can join.

for example server Xian is full for 0.83% you can do the following.
1.00 - 0.83 = 0.17 * 3500 which will result in the number of people who can join.

I don't know it is currently implemented in drew's tool so I'll take a look at it but you can do a lot of things with the data
06/30/2011 17:39 lesderid#25
Quote:
Originally Posted by kevin_owner View Post
The server stats of isro is just a decimal number in the packet so you don't really know how much people there are but since you know how full the server is you can calculate how much people can join.

for example server Xian is full for 0.83% you can do the following.
1.00 - 0.83 = 0.17 * 3500 which will result in the number of people who can join.

I don't know it is currently implemented in drew's tool so I'll take a look at it but you can do a lot of things with the data
1.00 - 0.83 isn't equal to 0.17 * 3500?
06/30/2011 18:07 kevin_owner#26
no i'm sorry that was not what i ment.
1.00 - 0.83 = 0.17
0.17 * 3500 = Users left to join.
That should be correct I guess thanks:)

Btw your number of thanks is evil
06/30/2011 20:07 inv123#27
This method will doesnt realy works if a new server opens with for example 2500 max. cap.^^
06/30/2011 20:49 kevin_owner#28
Indeed but you can't know the maximum users for a server in silkroad.
Before they changed the server list packet the packet contained 2 words. the first one was the current users in the server and the second one the maximum. but they changed it to a float so now the client only knows how full the server in a decimal.

So you just assume that the server cap is 3500 but they might have changed it to 1000 you can't know it.
06/30/2011 22:33 TheSpy#29
Theoretically speaking you could calculate it. 2999/3000 (0.99966666666666) and 3499/3500 (0,99971428571428) are both really close by, but you can calculate the delta value. You take the result that has the lowest delta value, because it will be more precise than any other.

I wrote this really quick so it's not an optimal solution, nor does it always work correctly.
PHP Code:
    function test($percent) {
        
$ret = array(00); // current, maximum
        
$step 50;
        
$start $step 20;
        
$tolerance 50// 350[3]/3500, 350[1]/3500; nuff said
        
$max 4500 $tolerance// known maximum is 3500
        
$mindelta 1000000// just set it high at the beginning
        
for($i $start$i <= $max$i += $step) {
            for(
$j = (int)($percent $i 5); $j <= $i $tolerance$j++) {
                
$prev = ($j 1) / $i;
                
$curr $j $i;

                if(
abs($percent $prev) <= $mindelta) {
                    
$mindelta abs($percent $prev);
                    
$ret = array($j 1$i);
                }

                if(
abs($percent $curr) <= $mindelta) {
                    
$mindelta abs($percent $curr);
                    
$ret = array($j$i);
                }

                if(
$curr $percent) {
                    break;
                }
            }
        }
        return 
sprintf("%.2f/%.2f"$ret[0], $ret[1]);
    } 
06/30/2011 23:04 S3cret#30
So how does Rev6 know the exact max value of a server which just opened?