All pastes #167526 Raw Edit

yadhed

public cpp v1 · immutable
·published 2006-09-12 02:10 UTC
rendered paste body
#include <a_samp>//#define YS_USE_PREFIX_ON			// Always on//#define YS_USE_PREFIX_OFF			// Always off//#define YS_USE_PREFIX_SEL			// INI defined//#define YS_ALT_NAMES_OFF			// Allows the commands to have different//#define YS_ALT_NAMES_ON			// names to the functions//#define YS_ALT_NAMES_SEL//#define YS_LOGGING_ON				// Sets wether callbacks are recorded//#define YS_LOGGING_OFF//#define YS_LOGGING_SEL//#define YS_MESSAGES_ON//#define YS_MESSAGES_OFF//#define YS_MESSAGES_SEL//#define YS_SECURE_COMMANDS_OFF//#define YS_SECURE_COMMANDS_ON//#define YS_SECURE_COMMANDS_SEL//#define YS_CHAT_OFF//#define YS_CHAT_ON//#define YS_CHAT_SEL//#define YS_USERS_OFF//#define YS_USERS_ON//#define YS_USERS_SEL//#define YS_INDIVIDUAL_FILES_ON//#define YS_INDIVIDUAL_FILES_OFF//#define YS_INDIVIDUAL_FILES_SEL//#define YS_INTERNAL_OFF//#define YS_INTERNAL_ON//#define YS_INTERNAL_SEL#define INI_NAME "yadmin.ini"#define MAX_LEVELS 16#define YS_MAX_CMD_LENGTH 32#if !defined YS_INTERNAL_OFF	#define YS_INT_USE			0x00000001	#define YS_INT_SHARE_LEVEL	0x00000002	#define YS_INT_SHARE_ID		0x00000004	#define YS_INT_USE_EXT		0x00000008	#define YS_INT_SHARE_LOG	0x00000010	#define YS_INT_SHARE_MUTE	0x00000020		// Settings shares		#define YS_INT_CHAT			0x00000100	#define YS_INT_ALT			0x00000200	#define YS_INT_PREFIX		0x00000400	#define YS_INT_SECURE		0x00000800	#define YS_INT_MESSAGES		0x00001000	#define YS_INT_USERS		0x00002000	#define YS_INT_LOGGING		0x00004000	#define YS_INT_INT			0x00008000	#define YS_INT_INDI			0x00010000		new gIntenalSettings = 0;		#define YS_INT_SET_CODE(%1,%2,%3) if ((%1) & (%2)) { gIntenalSettings |= (%3); } else { gIntenalSettings &= -1 ^ (%3); }	#define YS_INT_UNSET_CODE(%1) gIntenalSettings &= -1 ^ (%1);	#define YS_INT_QUICK_CODE(%1) gIntenalSettings |= (%1);#endif#define PASS_LENGTH 65#if !defined YS_USERS_OFF//#else	#define USER_FILE_INDEX "YSS_users.txt"	enum YS_USER_DATA	{		YU_BIN_DAT,		YU_USER_ID		//YU_LEVEL,		//YU_NAME[MAX_PLAYER_NAME]	}	// BIN_DAT data:		//#define YU_BIN_USER_LEVEL	0x000000FF	#define YU_BIN_LOGGED_ON	0x00000001	#define YU_BIN_MUTED		0x00000002	#define YU_BIN_BANNED		0x00000004		new gYSUserData[MAX_PLAYERS][YS_USER_DATA];	#define YU_USE_USERS		0x00000001	#define YU_USE_INDIVIDUAL	0x00000002		#if defined YS_INDIVIDUAL_FILES_OFF		new gUserSettings = -1 ^ YU_USE_INDIVIDUAL;	#else		new gUserSettings = -1;	#endif	//#if defined YS_USERS_ON	//#else	//#endif#endif#if defined YS_LOGGING_OFF	#define YS_LOG_CODE(%1,%2) //new str[256];#else	enum ST_DAT_ENUM	{	    ST[40],	    SN[2]	}	enum RS_DAT_ENUM	{	    RS_TXT[28],	    RS_NUM[3]	}	new gRecArray = -1;	//new gSaving = 1;	//new gTempBuf[1024];	new gLastSave;	new gSaveDelay = 1800;	new File:g_fLogFile;	new gDateFormat[11] = "dd:mm:yyyy";		new gPlayersConnected;	#define LOG_FILE_NAME "YSS_LOG.%s.txt"	#if defined YS_LOGGING_ON		#define YS_LOG_CODE(%1,%2) new str[256]; if (gRecArray & (%1)) { format(str, sizeof (str), %2); yLog(str); }	#else	    #define YS_LOG_CODE(%1,%2) new str[256]; if ((gRecArray & YS_USE_LOGGING) && (gRecArray & (%1))) { format(str, sizeof (str), %2); yLog(str); }	#endif#endif#if !defined YS_LOGGING_OFF || !defined YS_SECURE_COMMANDS_OFF	#define MAX_SKIPPED_COMMANDS 8	new gIgnoredCommands[MAX_SKIPPED_COMMANDS][YS_MAX_CMD_LENGTH];	new gFilteredCommands[MAX_SKIPPED_COMMANDS][YS_MAX_CMD_LENGTH];#endifnew gLevelNames[MAX_LEVELS][32];#define ID_DAT ReturnPlayerIDData(playerid)#define PAR_DAT(%1) (gRecArray & YS_USE_PAR_NAMING) ? "%1: " : ""#define ST_DAT(%1) (gRecArray & YS_USE_EXPANDED_PARS) ? statenames[(%1)][ST] : statenames[(%1)][SN]#define RS_DAT(%1) (gRecArray & YS_USE_EXPANDED_PARS) ? reasonnames[(%1)][RS_TXT] : reasonnames[(%1)][RS_NUM]#define USE(%1,%2) if (!((%1) & (%2))) return 0;#define YS_ON_FILTER_SCRIPT_INIT		0x00000001#define YS_ON_FILTER_SCRIPT_EXIT		0x00000002#define YS_ON_PLAYER_REQUEST_CLASS		0x00000004#define YS_ON_PLAYER_REQUEST_SPAWN		0x00000008#define YS_ON_PLAYER_CONNECT			0x00000010#define YS_ON_PLAYER_DISCONNECT			0x00000020#define YS_ON_PLAYER_SPAWN				0x00000040#define YS_ON_PLAYER_DEATH				0x00000080#define YS_ON_VEHICLE_SPAWN				0x00000100#define YS_ON_VEHICLE_DEATH				0x00000200#define YS_ON_PLAYER_TEXT				0x00000400#define YS_ON_PLAYER_PRIVMSG			0x00000800#define YS_ON_PLAYER_COMMAND_TEXT		0x00001000#define YS_ON_PLAYER_INFO_CHANGE		0x00002000#define YS_ON_PLAYER_ENTER_VEHICLE		0x00004000#define YS_ON_PLAYER_EXIT_VEHICLE		0x00008000#define YS_ON_PLAYER_STATE_CHANGE		0x00010000#define YS_ON_PLAYER_ENTER_CHECKPOINT	0x00020000#define YS_ON_PLAYER_LEAVE_CHECKPOINT	0x00040000#define YS_USE_LOGGING					0x80000000#define YS_USE_PAR_NAMING				0x40000000#define YS_USE_EXPANDED_PARS			0x20000000#define YS_USE_DAILY_SAVES				0x10000000#define LG_MSG_COLOR 0x00FFFFFF#define MAX_INI_LINE 128#define YS_INI_LOGGING			0#define YS_INI_MESSAGES			1#define YS_INI_MEMBERLEVELS		2#define YS_INI_COMMANDLEVELS	3#define YS_INI_ALTNAMES			4#define YS_INI_SETTINGS			5#define YS_INI_IGNORECOMMANDS	6#define YS_INI_FILTERCOMMANDS	7#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 ADD_FUNC(%1) if (count == function && dcmd_%1(playerid, text, help)) { return 1; } else { count++; }#define dcmd(%1,%2) if ((strcmp(cmdtext, "/%1", true, (%2) + 1) == 0) && (((cmdtext[(%2) + 1] == 0) && (dcmd_%1(playerid, ""))) || ((cmdtext[(%2) + 1] == 32) && (dcmd_%1(playerid, cmdtext[(%2) + 2]))))) return 1#define YS_HELP(%1) SendClientMessage(playerid, 0x00FFFFFF, (%1))new gUserLevel[MAX_PLAYERS] = {0, ...};new gComSet = -1; // XX, Use alt names, Use warnings, Use Prefix#define YS_COMSET_USE_PREFIX	0x00000001#define YS_COMSET_USE_WARNINGS	0x00000002#define YS_COMSET_USE_ALT		0x00000004#if defined YS_USE_PREFIX_OFF	#define YS_PREFIX_DISP_CODE ""#else	new gPrefix[8] = "/ys";	#if defined YS_USE_PREFIX_ON		#define YS_PREFIX_DISP_CODE prefixcode	#else		#define YS_PREFIX_DISP_CODE gComSet & YS_COMSET_USE_PREFIX ? prefixcode : ""	#endif#endif#if defined YS_ALT_NAMES_OFF	#define YS_COM_NAME_CODE(%1) gFuncNames[(%1)]#else	#if defined YS_ALT_NAMES_ON		#define YS_COM_NAME_CODE(%1) gAltNames[(%1)][0] ? gAltNames[(%1)] : gFuncNames[(%1)]	#else		#define YS_COM_NAME_CODE(%1) ((gComSet & YS_COMSET_USE_ALT) && (gAltNames[(%1)][0] != 0)) ? gAltNames[(%1)] : gFuncNames[(%1)]	#endif#endif#if defined YS_MESSAGES_OFF	#define YS_MESSAGE_CODE#else	#define YS_MESSAGE_CODE MessageCheck();	#define YS_MAX_MESSAGES 16	#define MS_BITS_MOTD		0x000000FF	#define MS_BITS_COUNT		0x0000FF00	#define MS_BITS_MOTD_TYPE	0x01000000 // 1 = Spawn, 0 = Connect	#define MS_BITS_MOTD_INC	0x02000000	#define MS_BITS_USE			0x04000000	new gMessageDat = 0xFFFFFFFF;	//new gLastMessage;	new gMessageDelay = 300;	//new gMessageCount = 0;	#define MS_TYPE_IGNORE 0x00010000	enum YS_MESSAGE_DAT	{		MS_TYPE, // 0xFFFF0000 - info, 0x0000FFFF - type		MS_INFO, // Color or display time depending on MS_TYPE		MS_TEXT_0[MAX_INI_LINE],		MS_TEXT_1[MAX_INI_LINE],		MS_TEXT_2[MAX_INI_LINE],		MS_TEXT_3[MAX_INI_LINE],		MS_TEXT_4[MAX_INI_LINE]	}	new gMessages[YS_MAX_MESSAGES][YS_MESSAGE_DAT];	//#pragma unused gLastMessage, gMessageCount, gMessageDelay		#if defined YS_MESSAGES_ON	#else	#endif#endif#if !defined YS_CHAT_OFF	#define YS_USE_CHAT 1	new gChatColor = 0x00FF00AA;	new gChannel[MAX_PLAYERS] = {-1, ...};	new gChanColor[MAX_PLAYERS];	new gChatSettings = -1;	new gChanInvite[MAX_PLAYERS] = {-1, ...};	new gChanPublic[MAX_PLAYERS] = {0, ...};	new gChanInfo[MAX_PLAYERS];#endif#if !defined YS_SECURE_COMMANDS_OFF	#define YS_SEC_USE 1	#define YS_SEC_REC 2	new gUseSecure = -1;#endif