![∗](img/star.gif)
![∗](img/star.gif)
![IMG:https://i560.photobucket.com/albums/ss44/leegao/site_logo.gif](https://i560.photobucket.com/albums/ss44/leegao/site_logo.gif)
![•](img/dot.gif)
####################################
How to write a user-admin System - Part 1
Hello, this is part one of the the "How to write a User-Admin System" for the upcoming Lua environment on CS2D 0.1.1.5 on top of the AMX2D System. Today we're going to be covering the initial planning and features of a customized user system with multiple access groups. So let's get started.
![>](img/i_next.png)
One of the biggest disadvantages of only letting server administrators use a RCON-Password based system is that everyone that you give out the password to will have TOTAL control of the server. Now let's picture a situation where the server owner Joe wants to have more people to help check for hackers on his server. Naturally his only option is to give out total control of the server to those he trusts to manage his server. Now let's say that a RCON holder Bob begins to abuse his RCON powers and Joe wants to take back the password or restrict him to only a few commands. What can he do? NOTHING. The only thing that he can really do is to reassign the rcon password and then redistribute out the passwords ALL OVER again. To top that, every time he wants to remove an admin, he has to do the same process over again. Now sooner or later, he will get tired of constantly updating the admins or having to think up of new passwords. There's got to be a better way of doing this.
So what do we do?
Thanks to the ability to write server-side scripts via the Lua runtime tunnel to the CS2D engine, we can now write an authentication system on Lua so we can designate different commands to different people based on their administrative permissions. Now let's say that we need 3 different permission levels, user, admin, and superadmin, and that we have a command that allows you to broadcast some message to everyone, in this case let's call it "/echo", and we only want people with privileges of admin and above to access this command. So what we need to do is to create a function for the player to login, a function to add the user's privilege level to the player list, and a function to check, when a command is called, whether the user has enough privilege to use this command at all.
![√](img/ok.gif)
![√](img/ok.gif)
![√](img/ok.gif)
And with that, we have the basic concepts of a flexible user-admin system for CS2D. If you've made it this far, then give yourself a good pat on the back because this will be the most boring and hard part of the process. In the next parts, we will finally begin coding and translating all of the ideas discussed here into a real script.
AMX2D Tutorial - Written by Lee Gao