![]() |
Monitoring levels
Just read a few guides on file input/output and came up with this that I thought is pretty cool. Basically you put this in a class and if a player enters that level that isn't allowed, it will send an rc chat alert and also save to logs. (players account, in which level, and at what time)
Comments and criticism welcomed. :) PHP Code:
|
Your styling is inconsistent (use of braces on own lines and indentation of braces). You should use account names internally, not community names. Logs should also contain account names (community names are fine in addition). Keep in mind that community names can change and some players have no community name set.
Instead of using a blank if-statement, just do PHP Code:
You should either use SPC or @ with a spaces inside the concatenated strings. Consistency is key. It looks like it will work, though. Thanks for submitting to the Code Gallery, we need more scripters interested in helping the community. In the future, it would probably be best if you post a thread outside of the Code Gallery first so that you can get feedback. The idea is for this forum to be a repository of high-quality scripts that can either be used or learned from. If you make a thread in the main NPC Scripting forum, there are plenty of scripters who will be happy to give you advice to help you polish it before posting it in the Code Gallery. |
Quote:
As to the community name / account thing, I thought using player.account was inefficient when the community name stuff came out? I could be wrong though, just something I read a while ago. And on the styling, for me its really just preference, its really easy for me to read/edit this way |
Thanks for updating your post.
Quote:
The problem is that community names can change, so you shouldn't rely on them. For example, if you have a bank system which uses a database NPC or SQL to store the player's balance based on their community name, that player will lose all their money if they get a new community name. Similarly, if you assign privileges based on community name, another player could take the previously used community name of the trusted player (which is no longer in use) and gain unauthorized access. Almost every user management structure in existence uses IDs (accounts) instead of display names for identification. These forums do as well; if you look at my profile, you'll see the URL ends in "?u=2568", which is my user ID. If Darlene were to rename my forum display name (cbk1994), I would keep the same ID. If it was based off of forum display name instead of ID, every instance of cbk1994 would have to be changed to the new value, and old links to my profile (?u=cbk1994) would stop working. It's the same general concept. Quote:
|
Ahh, I understand completely now about the accounts/community names.
Thank you again |
| All times are GMT +2. The time now is 12:42 PM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.