|
|
|
Helper Functions
IP address helper function library | View |
This include file contains a function to convert IP addresses supplied by adminmod into 32-Bit integers so they can be manipulated using bit-wise arithmatic e.g. for subnet masking.
It also converts the numeric IP address back into dotted string representation.
-[ Ravenous Bugblatter Beast ]-
|
Start a Clan War on your server. (updated) | View |
This command is usefull when beginning a clan war on your server. It kicks anyone not having the specified clan tags or not having immunity and puts a password on the server.
usage: admin_war (clantag1) (clantag2) (password)
-[ KaReL ]-
|
AdminMod Script for Invisibility Cheat Detection | View |
AdminMod provides the server admin with the possibility to protect certain models with a password. The Invisibility Cheat uses the models orange, oranget, arcticorange or arcticoranget. The use of the first two can be blocked by setting a password for them. If you set a password for the latter two, people will be unable to use the terror model arctic and get kicked from your server. This script detects the use of any of the above four models and displays a warning on the screen to all players that a player is trying to make himself invisible.
The view link contains a modified standard admin.sma with the cheat detection. If you want the whole package, try this link . The zip contains both Alfreds and Jags modified scripts.
-[ Da Rope ]-
|
A load of snippets nicely packaged. | View |
Here is a nice way to take care of your helper functions. This includes the original funcs from Alfreds script and a few others thrown in like:
- number_array - take a number and split it into an array of digits.
- execute_all - execute a command on all clients.
- speaktimeleft - say with an audible voice how much time is left on the map to all clients.
- usersearch - find the user name that most closely matches a string.
-[ [WHO]Them ]-
|
Finds first occurence of str2 in str1. | View |
Here is a little helper function I wrote in order to have some sort of AI type interface to people talking to the server. It should follow the same i/o format as ansi-C's strstr function.
In the client_command function, I added these two lines (for example) to detect if someone was asking about friendly fire:
code:
// If we think user is asking about friendly fire, we should answer if ( (strstr(data, "ff on") != 0) || (strstr(data, "ff is on") != 0) ) if (getvar("mp_friendlyfire") == 1) say("Friendly fire is ON"); else say("Friendly fire is OFF");
-[ Sank ]-
|
Extract the user from a command string | View |
I just don't like using numbers to address people so I use their quoted names. This function will extract the name as long as it is the first parameter in the admin_ command.
parseuser(RawStr[],UserStr[],Msg[])
The parameters are as follows: RawStr[] - is the raw data from the admin_ command. UserStr[] - is the string to hold the parsed username. MsgStr[] - is the string to hold remainder of the raw data from the admin_ command. The result of the function is the result of check_user based on the parsed name or zero if no user.
This function does require the strnsplit snippet to work.
If you want to see this command in action, check out my second tutorial that will give you a private message system for admins.
-[ Dio ]-
|
Locate a character within a string | View |
This function will find the occurance of a character within a string.
pos(cWhat[],cWhere[],nStart=0)
The parameters are simple:
cWhat[] is the the character to find. You can pass an entire string but only the first character of the string will be searched for. cWhere[] is the string to be searched. Enough said.
nStart=0 is the character position in cWhere to start searching. This parameter is optional due to the Small Compiler's ability to have default values in parameters.
-[ Dio ]-
|
Extract segments of a string | View |
If you need to parse strings, this is a helper function you might like.
strnsplit(a[],b[],n,m)
The strnsplit function will copy characters from b to a starting at the nth character and stoping at character m. Enjoy
-[ Dio ]-
|
|
|
|
|