English [UNUSED] Get Player Rank v1.4 icon

18 comments
30.07.13 04:58:26 am
like 14 like it!
2 kb, 281 Downloads
MikuAuahDark
User
Offline Off
INFO Because cs2d lua cmd stats already exists, you no longer need this script. Only download this if you want to know how to extract player rank information from sys/userstats.dat
Get player rank from userstats.dat by user MikuAuahDark

∗ Description ∗
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

∗ Features ∗
• > Get player rank from userstats.dat(it include kills, frags, deaths, and time on server)

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

∗ Reserved Global Variable
> GetUserStatsRank

∗ Information ∗
> Hooks: 0
> Lines: 35(with description 53 lines)
> Size: 881 Bytes(with description 1539 Bytes)

∗ Functions
> GetUserStatsRank(usgn(number))
• Parameters:
• - usgn, ID of the USGN to see the rank information from userstats.dat
• ∗ Returns: A information from userstats.dat(table)

∗ Table Index ∗
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)

∗ Special Thanks to ∗
• user DC: For the userstats.dat file format(at thread cs2d Server rank issue(score is altered)(Here))

∗ Rules ∗
√ You can use it for your server
√ You can edit it
√ You can upload at another website, say user MikuAuahDark made it
× You can't say this is yours
× You can't upload on another website without put me on credits

∗ Notes ∗
• 1. it doesn't use any library function(for stream files) for lua. it uses default io.open file:read function
• 2. if you want to learn how the code works, take a look at rank_desc.txt
• 3. there's a addional index which retrieves very first used player name on the server. Check rank.txt for more info

∗ PHP Implementation ∗
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
<?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;
}
?>


∗ Version History ∗
> V1.4
• > CHANGED Int function isn't global variable anymore
• > INFO Rewrite code from stratch. It now ~10x faster than V1.3
> V1.3
• > FIXED You can't read the first USGN that enter your server
> V1.2
• > CHANGED The file now is opened with binary mode which would solve a error that would not read the file correctly
> V1.1
• > REMOVED Player rank on server. I just accidently put "step" variable as rank number
> V1.0
• > ADDED Initial Release

∗ Another MikuAuahDark Scripts ∗
> file cs2d Timer Extra function(timerEx) v4.0 (12)
> file cs2d Env_Laser v1.0 (5)
> file cs2d Weapon Hudtxt v1.0 (7)
> file cs2d Improved Badwords v2.0 (5)
image
edited 10×, last 21.06.15 11:04:20 pm
ok This file has been reviewed and approved by Starkkz (01.12.15 09:37:07 pm)

Comments

18 comments
Goto Page
To the start Previous 1 Next To the start

Log in!

You need to log in to be able to write comments!Log in
17.08.15 12:12:59 pm
like I like it!
Up
HoOtix
User
Offline Off
Just great.It's so bad..BAD@SS! Epic
07.01.15 02:09:56 pm
like I like it!
Up
CrazyBooy
User
Offline Off
Good job. New version is more useful. We can take the player's first name in rank
04.01.15 07:52:13 pm
like I like it!
Up
JeeewNazi
User
Offline Off
Looks good!
Keep going
04.01.15 07:33:24 pm
like I like it!
Up
Legend7
User
Offline Off
nice work
01.01.15 12:23:42 pm
like I like it!
Up
ExEc ExE
User
Offline Off
Your work is so underrated.
Makes me cri everitem *Sad violin*
13.04.14 10:30:26 pm
like I like it!
Up
Avo
User
Offline Off
Just view Miku's files. They're useful, damn useful and nobody likes them.
13.04.14 09:09:39 pm
like I like it!
Up
Rainoth
Moderator
Offline Off
@user Avo: I can fix that.
31.03.14 07:54:29 pm
like I like it!
Up
TopNotch
User
Offline Off
user Avo: Agree.
File: Good work.
31.03.14 04:59:30 pm
like I like it!
Up
Avo
User
Offline Off
I always wonder why so awesome uploads have only about 5-8 likes.
31.07.13 07:11:44 am
like I like it!
Up
mr_s
User
Offline Off
how to do your time on server like that??

anyways, thank you!
31.07.13 05:30:43 am
Up
MikuAuahDark
User
Offline Off
Thanks. But i just accidently put "step" variable as Player Rank LOL.
30.07.13 08:55:42 pm
like I like it!
Up
BcY
User
Offline Off
looks good.
good job.
30.07.13 07:54:17 pm
like I like it!
Up
Communism
Reviewer
Offline Off
ooops, forgotten to put a like.
30.07.13 07:53:27 pm
like I like it!
Up
_Yank
User
Offline Off
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.
30.07.13 03:07:37 pm
like I like it!
Up
iii
User
Offline Off
same opinion as user D-D3ADxPro
30.07.13 11:36:19 am
like I like it!
Up
Communism
Reviewer
Offline Off
xD, I wanted to do this yesterday, you're a friggin ninja.
30.07.13 05:09:22 am
Up
MikuAuahDark
User
Offline Off
@user D-D3ADxPro: what hudtxt?? it just return table not return any message. The message on screenshot is just cs2d lua cmd msg2
30.07.13 05:02:52 am
like I like it!
Up
D-D3ADxPro
User
Offline Off
The only reason why I liked this file was because the description is filled with good information. This script is pretty useful.
edited 1×, last 30.07.13 05:13:10 am
To the start Previous 1 Next To the start