#include #include #include // This is a comment // uncomment the line below if you want to write a filterscript #define FILTERSCRIPT #define COLOR_GREY 0xAFAFAFAA #define COLOR_GREEN 0x33AA33AA #define COLOR_RED 0xE70000AA #define COLOR_YELLOW 0xFFFF00AA #define COLOR_WHITE 0xFFFFFFAA #define COLOR_BLUE 0x0000BBAA #define COLOR_LIGHTBLUE 0x33CCFFAA #define COLOR_ORANGE 0xFF9900AA #define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1 new pWatchID[ MAX_PLAYERS ]; dcmd_watch(playerid,params[]) { new String[ 65 ]; if ( !strlen( params ) ) { SendClientMessage(playerid, COLOR_WHITE, "USAGE: /watch [ID]"); return 1; } new WatchID = strval( params ); if( !IsPlayerConnected( WatchID ) ) { format( String, 65, "ID %d is not connected.", WatchID ); SendClientMessage( playerid, COLOR_ORANGE, String ); return 1; } TogglePlayerSpectating( playerid, 1 ); PlayerSpectatePlayer( playerid, WatchID, SPECTATE_MODE_NORMAL ); pWatchID[ playerid ] = WatchID; GetPlayerName(WatchID, String, MAX_PLAYER_NAME); format( String, 65, "You are now watching %s (ID: %d).", String, WatchID ); SendClientMessage( playerid, COLOR_ORANGE, String ); return 1; } dcmd_unwatch(playerid,params[]) { #pragma unused params new string[65]; if( pWatchID[ playerid ] == INVALID_PLAYER_ID ) { SendClientMessage(playerid, COLOR_ORANGE, "You are not watching a player."); return 1; } TogglePlayerSpectating( playerid, 0 ); GetPlayerName( pWatchID[ playerid ], string, MAX_PLAYER_NAME ); format( string, 128, "You have stopped watching %s (ID: %d).", string, pWatchID[ playerid ] ); SendClientMessage( playerid, COLOR_ORANGE, string ); pWatchID[ playerid ] = INVALID_PLAYER_ID; return 1; } dcmd_say(playerid,params[]) { new string[65]; if ( !strlen( params ) ) { SendMessage( playerid, "No message specified." ); return 1; } else { format(string, 65, "* Admin: %s", params); SendMessageToAll(string); return 1; } } public OnFilterScriptInit() { print("\n--------------------------------------"); print(" Blank Filterscript by your name here"); print("--------------------------------------\n"); return 1; } public OnFilterScriptExit() { return 1; } public OnPlayerCommandText(playerid, cmdtext[]) { if ( IsPlayerAdmin( playerid ) ) { /* We can put all our admin commands in one check, instead * of checking all the strings and then comparing IsPlayerAdmin. */ dcmd(say, 3, cmdtext ); dcmd(watch, 5, cmdtext ); dcmd(unwatch, 7, cmdtext ); } return 0; } strtok(const string[], &index) { new length = strlen(string); while ((index < length) && (string[index] <= ' ')) { index++; } new offset = index; new result[20]; while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1))) { result[index - offset] = string[index]; index++; } result[index - offset] = EOS; return result; } SendMessage(playerid, const str[]) { SendClientMessage(playerid, 0xFF9900AA, str); } SendMessageToAll(const str[]) { SendClientMessageToAll(0xFF9900AA, str); } SendMessageToAdmins(const str[]) { for (new i = 0; i < MAX_PLAYERS; i++) { if (IsPlayerConnected(i)) { if (IsPlayerAdmin(i)) { SendClientMessage(i, COLOR_RED, str); } } } }