Forum

> > CS2D > Scripts > how do the commands and the ranks folder separate?
Forums overviewCS2D overview Scripts overviewLog in to reply

English how do the commands and the ranks folder separate?

2 replies
To the start Previous 1 Next To the start

old how do the commands and the ranks folder separate?

phalenkO
User Off Offline

Quote
Hello, in some cases, start with "Admin = {142925}", I want to import the administrator from another folder. For example, I want to set up a folder called "ranks.lua" and access "admin, mod, and vip" files. How can I do that? I apologize for the title
edited 1×, last 16.06.18 06:46:38 pm

old Re: how do the commands and the ranks folder separate?

Rainoth
Moderator Off Offline

Quote
You'll have to use "join" and "leave" (doesn't necessarily have to be these two but most people go for these two) hooks and in their functions use the io library to save and load the information of users in files.
So to put it simply (this is a pseudocode)
1
2
3
4
5
6
7
8
9
10
11
12
13
add hook join with function A
function A(id)
  io open a file called lets say "user"..player(id,"usgn") (or can be steam id if you prefer it over usgn id)
  read the contents
  use the contents how you wish
end

add hook leave with function B
function B(id)
  io open a file "user"..player(id,"usgn") (or again, steam)
  write the contents you have in your variables
  save
end

Refer to http://lua-users.org/wiki/IoLibraryTutorial for this.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview