[UNUSED] Get Player Rank v1.4 
18 comments

Get player rank from userstats.dat by



This lua allows you to get player stats from userstats.dat file located at "sys/stats" folder
It include Kills, Frags, Deaths, and Time on Server






Put files at desired folder and edit server.lua to execute rank.txt.















Table returned by GetUserStatsRank function have this index:
isexists - Is the rank exists(boolean)
score - USGN Score(number)
frags - USGN frags(number)
deaths - USGN deaths(number)
time - Time on server(in seconds)(number)





















Here's the PHP implementation of v1.4(tested in PHP 5.5.0)
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
function GetUserStatsRank($usgn) {
$Int=function($f) {
return ord(fread($f,1))+ord(fread($f,1))*256+ord(fread($f,1))*65536+ord(fread($f,1))*16777216;
};
$f=fopen("sys/stats/userstats.dat","rb");
fseek($f,0,SEEK_END);
$size=ftell($f);
fseek($f,17,SEEK_SET);
$temp=[
"isexists"=>FALSE,
"score"=>0,
"frags"=>0,
"deaths"=>0,
"time"=>0,
];
while(ftell($f)!=$size) {
fgets($f); // skip player name
$temp_usgn=$Int($f);
if($usgn==$temp_usgn) {
$temp["isexists"]=TRUE;
$temp["score"]=$Int($f);
$temp["frags"]=$Int($f);
$temp["deaths"]=$Int($f);
$temp["time"]=$Int($f);
break;
} else fseek($f,16,SEEK_CUR);
}
fclose($f);
return $temp;
}
?>
function GetUserStatsRank($usgn) {
$Int=function($f) {
return ord(fread($f,1))+ord(fread($f,1))*256+ord(fread($f,1))*65536+ord(fread($f,1))*16777216;
};
$f=fopen("sys/stats/userstats.dat","rb");
fseek($f,0,SEEK_END);
$size=ftell($f);
fseek($f,17,SEEK_SET);
$temp=[
"isexists"=>FALSE,
"score"=>0,
"frags"=>0,
"deaths"=>0,
"time"=>0,
];
while(ftell($f)!=$size) {
fgets($f); // skip player name
$temp_usgn=$Int($f);
if($usgn==$temp_usgn) {
$temp["isexists"]=TRUE;
$temp["score"]=$Int($f);
$temp["frags"]=$Int($f);
$temp["deaths"]=$Int($f);
$temp["time"]=$Int($f);
break;
} else fseek($f,16,SEEK_CUR);
}
fclose($f);
return $temp;
}
?>







































edited 10×, last 21.06.15 11:04:20 pm

Comments
18 comments



Log in!
You need to log in to be able to write comments!Log in

This type of script would help me too much. I hate when someone asks me to say rank. I need to move my hands start hitting the keys ._.
Then they ask how can they view other infos and i have to teach them how they can activate the fullrankinfo using my fingers again.
And about how to install, you could edit it and write "Put it inside autorun folder". Seems like you want to see comments like i cant install
Good, script, clean and small. Above my lua skills. You could do mathmatics to know the time on server in hours or minutes.
Then they ask how can they view other infos and i have to teach them how they can activate the fullrankinfo using my fingers again.
And about how to install, you could edit it and write "Put it inside autorun folder". Seems like you want to see comments like i cant install

Good, script, clean and small. Above my lua skills. You could do mathmatics to know the time on server in hours or minutes.
@
D-D3ADxPro: what hudtxt?? it just return table not return any message. The message on screenshot is just
msg2





