Our Scripts Vault contains many game scripts that you can use to create your own game!
Edit player profiles? Or at least block part of them until they replace it with something that is allowed. For example they have rude words, dirty picture etc...
The levels i have set up so far are:-1 = Banned (user cannot log in and is given a msg saying so) (technically this is a permanant ban)0 = Muted (user cannot communicate but still play the game)1 = Normal user5 = Moderator9 = Admin10 = Super Admin I skipped some numbers just in case I needed to add other ranks later.
Linear is better, in practice you will be doing a lot of if(access)>=X.
if (checkPermission ('perm name')) // do we have auth?
I think both linear and bit-packing are bad ideas.You have a users table in the database. Create a Role table with columns id, title and the entries Player, Moderator, Admin. Create a table UserRoles with columns user_id, role_id to join to users, who may have many roles. Create a table Permissions with columns id, slug (a constant for use in code, especially nice if your language supports symbols), and description (human-readable)... maybe a detail column or two to constrain, so a permission could give the right to delete messages in only one subforum. Last, a table to link Roles and Permissions.You can do it in code instead of db (and that might be better if you're not going to have a lot of permissions or changes), but don't create a linear scale that unduly constrains your permisisons or hassle around with bit-twiddling unless it's worth the hours or days to save a couple bytes on the couple user objects that aren't players.
$perms = array( 1=>'allow this', 2=>'allow that', 4=>'allow access to this', 8=>'allow access to that',);
if (!empty($binary_str[3])) { //he has access to something that`s fourth key in array}
(but I encourage all competitors to make an extensible, plugin supporting OOP based panel with bit masks for multilayer permissions stored in a special table plus a multilanguage translation system with skins, templates and proper abstraction layer, this way they will not have the time to implement features that could give them a competitive advantage and steal my players)
then you can simply check like:Code: [Select]if (!empty($binary_str[3])) { //he has access to something that`s fourth key in array}No need to check something like $row['perm']>=4 or something in code, each permission have certain number/position.
if ($user->can_delete_posts()) { ...}
function can_delete_posts() { if (SomeOtherFunc()) { return true; } else { return false; }}if ($user->can_delete_posts()) { // do this}
if (SomeOtherFunc()) { // do it}
Every byte counts! The more light code you write, the more performance you get. Anyway performance > business logic.
I saw your list of basics and one thing shocked me "Last 50 messages sent". Now it's time to get on my soap box of Ethics and running a game. Please take this all as my opinion and remember it's your game you can do what you damn well please When you offer in game messaging and put it in your Terms of Service that you have the right to read those messages doesn't mean you or your staff should. At the very least it doesn't mean your staff should. When people write messages in the game they believe (I hope) that these are private messages sent to another party or parties, just like email. The contents of said email are private. Reading players messages or giving staff the ability to do so could cause a lot of heartache and disconnect from the player base (yes I know even though they agreed to it in the TOS on signup).I'm no saint I've read emails in the past myself but only when I get a heads up about abuse from a player. Only then will I read them, most of the time the person cut, copies and pastes the original so all I need to do is execute a search and compare. To me reading other peoples messages back and forth just seems "dirty", but in some cases I agree it has to be done. Personally we don't have an admin page for that, only those with direct database access can do that.The other problem is, you are looking at having a staff. If your game has any type of group dynamic this may cause problems with your users. If your staff is reading emails and playing the game or have friends play the game this is going to give them intimate knowledge of whats going on inside the game and the community. Even if it never happens all it takes is for one person to know a staff member is reading messages and the next thing you know you have a huge conspiracy outcry.Like I said, my personal thoughts on the matter, hopefully it'll give you something to think about.