//------------------------------------------- // NFS Filter Script v1.1 // Designed for SA-MP v3.0b //------------------------------------------- #include #include #define MAX_NOTES 50 #define MAX_MODERATORS 10 #define INVALID_NOTE_ID 1337 #define COLOR_REPORT 0xFFFF91FF #define COLOR_YELLOW 0xFFFF00AA #define COLOR_GRAD2 0xBFC0C2FF #define COLOR_GREEN 0x33AA33AA forward SendNoteToQue(notefrom, note[]); forward ClearNotes(); forward LoadNotes(); forward SaveNotes(); forward split(const strsrc[], strdest[][], delimiter); enum notesinfo { HasBeenUsed, Note[128], NoteFrom[MAX_PLAYER_NAME], } new Notes[MAX_NOTES][notesinfo]; enum moderatorsinfo { HasBeenUsed, ModeratorTitle[68], ModeratorName[MAX_PLAYER_NAME], } new Mods[MAX_MODERATORS][moderatorsinfo]; new modcount = 0; INI:moderators[](name[], value[]) { strmid(Mods[modcount][ModeratorName], name, 0, strlen(name), 128); strmid(Mods[modcount][ModeratorTitle], value, 0, strlen(value), 128); printf("%s = %s (modcount = %d)", name, value, modcount); modcount++; } public OnFilterScriptInit() { print("\n Notes v1.1 Loading..."); INI_Load("moderators.ini"); LoadNotes(); } public OnFilterScriptExit() { print("\n Notes Script UnLoaded"); return 1; } public SendNoteToQue(notefrom, note[]) { new bool:breakingloop = false, newid = INVALID_NOTE_ID; for(new i=0;i 0) { format( string, sizeof( string ), "Title: %s Name: %s.", Mods[i][ModeratorTitle], Mods[i][ModeratorName] ); SendClientMessage( playerid , COLOR_GRAD2 , string ); } } } if(strcmp(cmd, "/notes", true) == 0) { SendClientMessage(playerid, COLOR_GREEN, "____________________ NOTES _____________________"); for(new i = 0; i < MAX_NOTES; i++) { if(Notes[i][HasBeenUsed] == 1) { format(string, sizeof(string), "NID %d | From:%s | Note: %s.", i, (Notes[i][NoteFrom]), (Notes[i][Note])); SendClientMessage(playerid, COLOR_REPORT, string); } } SendClientMessage(playerid, COLOR_GREEN, "___________________________________________________"); return 1; } return 0; } stock GetPlayerNameEx(playerid) { new string[MAX_PLAYER_NAME]; GetPlayerName(playerid, string, sizeof(string)); for(new i; i < MAX_PLAYER_NAME; i++) if (string[i] == '_') string[i] = ' '; return string; } stock IsPlayerModerator(playerid) { new name[MAX_PLAYER_NAME]; GetPlayerName(playerid, name, sizeof(name)); for(new i=0;i ' ') && ((index - offset) < (sizeof(result) - 1))) { result[index - offset] = string[index]; index++; } result[index - offset] = EOS; return result; } public split(const strsrc[], strdest[][], delimiter) { new i, li; new aNum; new len; while(i <= strlen(strsrc)){ if(strsrc[i]==delimiter || i==strlen(strsrc)){ len = strmid(strdest[aNum], strsrc, li, i, 128); strdest[aNum][len] = 0; li = i+1; aNum++; } i++; } return 1; } public OnPlayerSpawn(playerid) { if(GetPVarInt(playerid, "FirstSpawn") == 1) { if(IsPlayerModerator(playerid)) { SendClientMessage(playerid, COLOR_GREEN, "You are allowed to use '/addnote' '/delnote' '/clearnotes'"); } else { SendClientMessage(playerid, COLOR_GREEN, "Please make sure you check /notes before doing anything."); } } }