Don't think I ever looked at the code before, but now I found a few more places to improve the code from v10. This is basically what I did:
PHP Code:
/*
v1.1 (by me) was modified from v1.0.7:
- Fixed up 1 if/else if case.. removed 3 or 4 checks, with the poential to skip a couple more.
- Fixed another if/else case from 2 possibilites to 3 (with the same number of checks).
- Made the teleport somewhat random (x & y only - z should always be up).
- Renamed the command from stuck to sm_stuck. This allows you to use sm_stuck in console, as well as !stuck, !sm_stuck, /stuck and /sm_stuck in chat.
- Added color the the chat messages
- Renamed the global vars and initialized the handles.
- Reduced the number of calls on the teleport cvar.
- Enforced good code format (with #pragma semicolon 1)
- Cleaned up indentation and some un-necessary comments (either from code that no longer exists or because the var name is more clear now).
*/
You can change the amount of teleporting with:
PHP Code:
#define MIN_TELEPORT 3
#define MAX_TELEPORT 5
near the top of the source - the original was just 4. I haven't played around with the numbers much yet which is why I setup the option like that.
*removed plugin - see later post..