Gotta love Kye deleting my account and thus all the topics that went with it. Anyway, some of my useful functions I've made over the years have been ported to YSI and put in the YSI_misc.own file. The file can be found:
here
Functions include:
swap(var1, var2) - Swap two variables without a third variable.
xor:==xor: - Do a logical xor check on two variables.
ceildiv - Divide two integers and round up.
isnull - Used for empty strings passed via CallRemoteFunction.
iseven - Obvious.
isodd - Obvious.
floordiv - Rounded down integer division.
chrfind - Find a single character in a string, faster than strfind for single characters.
chrnfind - Find the end of a set of characters in a string (for example to skip a set of spaces).
strcpy - Copy a string.
bernstein - Like Adler32 hash but faster and less collisions.
bernstein_copy - Mix of strcpy and bernstein for speed.
StripNL - Similar to PHP's rtrim.
strconcat - Stick two strings together.
QuickSort - Call wrapper for QSort, sorts an array into newmerical order.
QSort - Workhorse recursive function for QuickSort.
chrtolower - Convert a character to lowercase.
strtolower - Convert a string to lowercase.
hexstr - strval for hex strings.
binstr - Checks if a string is "0" or "false".
ReturnPlayerName - Obvious.
ishex - Checks if a string is hexadecimal.
numstr - Converts a number to a string, should use valstr but doesn't.
chrtoupper - Convert a character to upper case.
strtoupper - Convert a string to upper case.
timestamp - Get the unix timestamp for the current time.
mktime - Get the unix timestamp for a given time.
GetIP - Return a player's IP as a 32bit integer.
getintpar - Gets a number from a string apparently.
IsConnected - Like IsPlayerConnected but uses YSI's internal foreach system.
KickDelay - Kick a player after a given amount of time. Used to ensure they get the message sent.
KickDelayCall - public function KickDelay calls.
BanDelay - Like KickDelay but ban.
BanDelayCall - Like KickDelayCall but ban.
endofline - Checks if the current position is the end of non-whitespace data.
isnumeric - Checks if a string is numeric.
abs - Returns the absolute (positive) value of a number.
sscanf - Deserves (
and has) it's own tutorial on use.
explode - Like PHP's explode function.
IsPlayerInRangeOfPoint - Checks if a player is near a point without calling floatsqroot for speed.
The library also has a couple of useful variables:
TRUE - Always true, used for infinate loops.
FALSE - Always false, used for large code macros.
NULL - The string passed instead of an empty string by CallRemoteFunction due to the way the PAWN VM works.