Forum

> > CS2D > Scripts > How to control rank (lua)
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch How to control rank (lua)

2 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt How to control rank (lua)

limonata
User Off Offline

Zitieren
Hello guys i want to make a script but i couldnt find the right hooks etc.

Script will make vip automatically who is first ten in rank list.

May you give me some tips?

Note: I dont want to script just tips. I wanna do it my self.

Thanks.

Edit: May somebody help me ?
1× editiert, zuletzt 06.06.13 02:21:08

alt Re: How to control rank (lua)

VaiN
User Off Offline

Zitieren
Assuming you already have the privilege/admin system, you just need to parse the rank list (sys/stats/userstats.dat). It's saved as bytes, so you'd need a library that can handle that. CS2D doesn't like importing external modules, so you may want to start with a Lua-only system.

Stream functions library for Lua by Starkkz can supposedly work with byte streams, but I've never used it so I can't provide any advice there.

The first step would be to figure out how each player's stats/rank is separated, then you can loop through the first ten and determine which part of the data is their USGN.

Once you know how to get the top ten, then make a function that will add the top ten to a Lua table. You could possibly call this function in the minute hook (depending on performance).

Then make a function that checks if a given USGN is in that table. You could call this in the join hook, and if the return value is true, set that player's rank to VIP (however your admin script handles the ranks).

Hope that helps.
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht