Dateien

> > CS2D > Lua Scripts > [UNUSED] Get Player Rank v1.4
DateiübersichtCS2D-ÜbersichtLua Scripts-Übersicht

Englisch [UNUSED] Get Player Rank v1.4 >

18 Kommentare2 kb, 650 Downloads

alt [UNUSED] Get Player Rank v1.4

MikuAuahDark
User Off Offline

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)
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
> file cs2d Env_Laser v1.0
> file cs2d Weapon Hudtxt v1.0
> file cs2d Improved Badwords v2.0
10× editiert, zuletzt 21.06.15 23:04:20
Zugelassen von Starkkz

Download Download

2 kb, 650 Downloads

Kommentare

18 Kommentare
Zum Anfang Vorherige 1 Nächste Zum Anfang

Logge dich ein!

Du musst dich einloggen, um selber Kommentare verfassen zu können!Einloggen

alt

HoOtix
User Off Offline

Just great.It's so bad..BAD@SS! Epic
Ich mag es!

alt

Sapiens
User Off Offline

Good job. New version is more useful. We can take the player's first name in rank
Ich mag es!

alt

Ajmin
User Off Offline

Looks good!
Keep going
Ich mag es!

alt

Legend7
User Off Offline

nice work
Ich mag es!

alt Cries

ExEc ExE
User Off Offline

Your work is so underrated.
Makes me cri everitem *Sad violin*
Ich mag es!

alt

Avo
User Off Offline

Just view Miku's files. They're useful, damn useful and nobody likes them.
Ich mag es!

alt

Rainoth
Moderator Off Offline

@user Avo: I can fix that.
Ich mag es!

alt

TopNotch
User Off Offline

user Avo: Agree.
File: Good work.
Ich mag es!

alt

Avo
User Off Offline

I always wonder why so awesome uploads have only about 5-8 likes.
Ich mag es!

alt

mr_s
User Off Offline

how to do your time on server like that??

anyways, thank you!
Ich mag es!

alt

MikuAuahDark
User Off Offline

Thanks. But i just accidently put "step" variable as Player Rank LOL.

alt

BcY
Reviewer Off Offline

looks good.
good job.
Ich mag es!

alt

Infinite Rain
Reviewer Off Offline

ooops, forgotten to put a like.
Ich mag es!

alt

_Yank
User Off Offline

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.
Ich mag es!

alt

Infinite Rain
Reviewer Off Offline

xD, I wanted to do this yesterday, you're a friggin ninja.
Ich mag es!

alt

MikuAuahDark
User Off Offline

@user D-D3ADxPro: what hudtxt?? it just return table not return any message. The message on screenshot is just cs2d lua cmd msg2

alt

D-D3ADxPro
User Off Offline

The only reason why I liked this file was because the description is filled with good information. This script is pretty useful.
Ich mag es!
1× editiert, zuletzt 30.07.13 05:13:10
Zum Anfang Vorherige 1 Nächste Zum Anfang