English How to control rank (lua)

2 replies
Goto Page
To the start Previous 1 Next To the start
05.06.13 05:34:18 pm
Up
limonata
User
Offline Off
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 ?
edited 1×, last 06.06.13 02:21:08 am
07.06.13 11:58:12 am
Up
VaiN
User
Offline Off
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.
07.06.13 12:12:47 pm
Up
limonata
User
Offline Off
Thank you
To the start Previous 1 Next To the start