Forum

> > CS2D > Scripts > How to control rank (lua)
Forums overviewCS2D overview Scripts overviewLog in to reply

English How to control rank (lua)

2 replies
To the start Previous 1 Next To the start

old How to control rank (lua)

limonata
User Off Offline

Quote
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

old Re: How to control rank (lua)

VaiN
User Off Offline

Quote
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.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview