#include //#define CHECK_STR(%1) if (%1[0] & 0xFFFFFF00) %1[0] = 0; #define CHECK_STR(%1) if (%1[0] == 1) %1[0] = 0; #define REQUIRE_STR(%1) if ((%1[0] & 0xFFFFFF00) || (%1[0] == 1)) return 0; #define ADD_MODULE(%1,%2) CallRemoteFunction("AddModule", "ssi", %1, %2, 0); #define REMOVE_MODULE(%1) CallRemoteFunction("RemoveModule", "s", %1); //#define CHECK_STR(%1) if (%1[0] == 1) %1[0] = 0; #define REGISTER(%1,%2,%3) CallRemoteFunction("RegisterCommand", "ssi", %1, %2, %3); #define LG_MSG_COLOR 0x00FFFFFF #define YS_HELP(%1) CallRemoteFunction("SendFormattedMessage", "iis", playerid, 0x00FFFFFF, %1) #define COMFOR(%1) forward %1(playerid, text[], help); #define READINI ReadINI(0); CallRemoteFunction("ReadINI", "i", 1); #define INI_NAME "yadmin.ini" #define MAX_INI_LINE 128 #define INI_GET_I(%1,%2,%3) if (strcmp(str, "%1", true, (%3)) == 0) %2 = strval(ReturnINIValue(str[(%3)])); #define INI_GET_H(%1,%2,%3) if (strcmp(str, "%1", true, (%3)) == 0) %2 = hexval(ReturnINIValue(str[(%3)])); #define INI_GET_F(%1,%2,%3) if (strcmp(str, "%1", true, (%3)) == 0) %2 = floatstr(ReturnINIValue(str[(%3)])); #define INI_GET_S(%1,%2,%3) if (strcmp(str, "%1", true, (%3)) == 0) { strmid(%2, ReturnINIValue(str[(%3)]), 0, MAX_INI_LINE); StripNL(%2); } #define INI_GET_B(%1,%2,%3,%4) if (strcmp(str, "%1", true, (%3)) == 0) { if (strval(ReturnINIValue(str[(%3)]))) { (%4) |= (%2); } else { (%4) &= -1 ^ (%2); }} #define INI_GROUP(%1) if (strcmp(str, "[%1]", true) == 0) group = YS_INI_%1; #define INIT if (update) continue; #define MAX_COMMANDS 128 // Maximum number of commands you can have #define MAX_FUNC_NAME 32 // Length a function name can be #define MAX_STRING 128 #define MAX_MODULES 16 #define PROCESS_LOOP_DELAY 200 #define PRIORITY(%1) static calls_%1; calls_%1++; if (calls_%1 >= %1 && (calls_%1 = 0) == 0) // A dirty hack to have lots of priorities in one function and have them reset #if !defined YSS_MINIMAL_SETTINGS // Define that BEFORE you include this file to exclude all the // actual things which take up space, used or not. Mainly INI stuff // Everything above here is defines so don't exist if you don't use them new gPrefix[16] = "/ys"; #pragma unused gPrefix GetININame(name[], str[]) { new i; while (str[i] != ' ' && str[i] != '=' && str[i] != 0) { name[i] = str[i]; i++; } return i; #pragma unused GetININame } ReturnINIValue(string[]) { //#pragma unused ReturnINIValue new retstr[MAX_INI_LINE] = ""; new i = 0, j; j = strlen(string); while ((string[i] == ' ' || string[i] == '=') && i < j) { i++; } if (i < j) { strmid(retstr, string, i, j); } return retstr; /*new e = strfind(str, "=") + 1; if (e == strlen(str)) return 0; return strtok(str, e);*/ #pragma unused ReturnINIValue } strtok(string[], &index) { new length = strlen(string); while ((index < length) && (string[index] <= ' ')) { index++; // Strip leading spaces } new offset = index; new result[32]; while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof (result) - 1))) { result[index - offset] = string[index]; index++; } result[index - offset] = EOS; /*while ((index < length) && (string[index] <= ' ')) { index++; // Strip trailing spaces (required now) }*/ return result; #pragma unused strtok } StripNL(str[]) { new l = strlen(str) - 1; if (l != -1 && (str[l] == '\n' || str[l] == '\r')) { str[l] = 0; l--; if (l != -1 && (str[l] == '\n' || str[l] == '\r')) { str[l] = 0; } } #pragma unused StripNL } #endif