From 7850b215bc93e63f9a915fab5efdccef29b0e8d1 Mon Sep 17 00:00:00 2001 From: Steven Howard Date: Tue, 25 Sep 2018 22:06:23 +0100 Subject: [PATCH] dialog based /acmds --- .../cnr/commands/admin/_admin.pwn | 219 +++++++++++++++++- 1 file changed, 217 insertions(+), 2 deletions(-) diff --git a/gamemodes/irresistible/cnr/commands/admin/_admin.pwn b/gamemodes/irresistible/cnr/commands/admin/_admin.pwn index b0dc4b4..75e601c 100644 --- a/gamemodes/irresistible/cnr/commands/admin/_admin.pwn +++ b/gamemodes/irresistible/cnr/commands/admin/_admin.pwn @@ -1,17 +1,232 @@ /* * Irresistible Gaming (c) 2018 - * Developed by Lorenc Pekaj + * Developed by Lorenc Pekaj, Steven Howard * Module: cnr/commands/admin/_admin.pwn * Purpose: encloses all admin related commands */ +/* ** Includes ** */ +#include < YSI\y_hooks > + /* ** Definitions ** */ #define ADMIN_COMMAND_REJECT "You don't have an appropriate administration level to use this command." #define ADMIN_COMMAND_TIME 4 +#define DIALOG_ADMIN_CMDS 1167 +#define DIALOG_ADMIN_CMDS_BACK 1168 +/* ** Variables ** */ + +enum E_COMMAND_DATA +{ + E_LEVEL, + E_COMMAND[ 64 ], + E_DESCRIPTION[ 144 ], +} + +new + g_CommandData [ ] [ E_COMMAND_DATA ] = + { + /* ** Level 1 Commands ** */ + { 1, "/viewdeathmsg", "Viewing a player death message" }, + { 1, "/arepair", "Fixing a vehicle" }, + { 1, "/aka", "Player name changes (also known as)" }, + { 1, "/pinfo", "Related information about a player" }, + { 1, "/reports", "Showing the last 8 reports" }, + { 1, "/questions", "Showing the last 8 questions" }, + { 1, "/respawnalluv", "Respawning all unused vehicles" }, + { 1, "/aod", "Admin on Duty mode" }, + { 1, "/asay", "Speak as a Admin." }, + { 1, "/frules", "Forcing player to view the rules" }, + { 1, "/fpc", "Forcing player to view player colors" }, + { 1, "/freeze", "Freezing a player" }, + { 1, "/unfreeze", "Unfreezing a player" }, + { 1, "/awep", "Showing player current weapons" }, + { 1, "/alog", "Shows administration log textdraw" }, + { 1, "/stpfa", "Blocking/unblocking a player from using /ask" }, + { 1, "/ans", "Answering a question" }, + { 1, "/respond", "Responding to a report" }, + { 1, "/aspawn", "Spawning a player" }, + { 1, "/warn", "Warning a player" }, + { 1, "/setskin", "Setting a player s speific skin ID" }, + { 1, "/stpfr", "Blocking/unblocking a player from using /report" }, + { 1, "/getstats", "Gettings the stats of a player" }, + { 1, "/a", "Admin chat" }, + { 1, "/adminmanual", "Reading the admin manual" }, + { 1, "/slap", "Slaping a player (default offset = 10)" }, + { 1, "/jail", "Jailing a player" }, + { 1, "/unjail", "Unjailing a player" }, + { 1, "/spec", "Spectating a player" }, + { 1, "/specoff", "Turning specation mode off" }, + { 1, "/goto", "Teleporting to a player" }, + { 1, "/mutelist", "Showing a list of muted players" }, + + /* ** Level 2 Commands ** */ + { 2, "/slay", "Slaying a player" }, + { 2, "/viewnotes", "Viewing a players V.I.P notes" }, + { 2, "/suspend", "Suspending a player" }, + { 2, "/arenas", "Showing a dialog of arenas for events" }, + { 2, "/explode", "Exploding a player" }, + { 2, "/vrespawn", "Respawning a vehicle ID" }, + { 2, "/vdestroy", "Destroying a admin vehicle" }, + { 2, "/mute", "Muting a player" }, + { 2, "/unmute", "Unmuting a player" }, + { 2, "/kick", "Kicking a player from the server" }, + + /* ** Level 3 Commands ** */ + { 3, "/smlog", "Cash transaction log from a player" }, + { 3, "/iclog", "IC transaction log from a player" }, + { 3, "/resetwep", "Resetting weapons from a player" }, + { 3, "/getip", "Getting IP of a player" }, + { 3, "/geolocate", "Geographical location of a player" }, + { 3, "/copwarn", "Cop warn a player" }, + { 3, "/armywarn", "Army warn a player" }, + { 3, "/rcopwarn", "Removing a cop warning" }, + { 3, "/rarmywarn", "Removing a army warning" }, + { 3, "/forcecoptutorial", "Forcing a player to view the cop tutorial" }, + { 3, "/ann", "Creates a global annoucement" }, + { 3, "/announce", "Creates a global annoucement" }, + { 3, "/aheal", "Healing a player" }, + { 3, "/healall", "Healing everyone" }, + { 3, "/vadminstats", "Viewing vehicle stats" }, + { 3, "/vadminpark", "Parking a vehicle" }, + { 3, "/givewep", "Giving a player a weapon" }, + { 3, "/giveweapon", "Giving a player a weapon" }, + { 3, "/cc", "Clearing the main chat" }, + { 3, "/clearchat", "Clearing the main chat" }, + { 3, "/vbring", "Bring a vehicle ID to you" }, + { 3, "/vgoto", "Teleport to a vehicle ID" }, + { 3, "/venter", "Enter a vehicle ID" }, + { 3, "/vforce", "Forcing a player to enter vehicle ID" }, + { 3, "/hgoto", "Teleport to a house" }, + { 3, "/bgoto", "Teleport to a business" }, + { 3, "/cd", "Countdown (short)" }, + { 3, "/countdown", "Countdown" }, + { 3, "/pingimmune", "Making a player immune from ping kicker" }, + { 3, "/ban", "Banning a player" }, + { 3, "/bring", "Bring a player to you" }, + + /* ** Level 4 Commands ** */ + { 4, "/destroyallav", "Destroys all admin spawned vehicles" }, + { 4, "/event", "Set's your world to 69" }, + { 4, "/setworld", "Sets your virtual world" }, + { 4, "/setinterior", "Sets your interior ID" }, + { 4, "/uncopban", "Unbanning a player from cop class" }, + { 4, "/unarmyban", "Unbanning a player from army class" }, + { 4, "/motd", "Sets a Message Of The Day" }, + { 4, "/resetwepall", "Resets all player weapons" }, + { 4, "/giveweaponall", "Gives all players a weapon" }, + { 4, "/circleall", "Teleports all players around in a circle of you (used for events)" }, + { 4, "/vc", "Creating a admin vehicle (short)" }, + { 4, "/vcreate", "Creating a admin vehicle" }, + { 4, "/gotopos", "Teleport to a specifc location X Y Z" }, + { 4, "/addnote", "Attach a note to a player" }, + { 4, "/removenote", "Removing a player note" }, + + /* ** Level 5 Commands ** */ + { 5, "/armorall", "Giving everyone armour" }, + { 5, "/check", "Checking a players serial" }, + { 5, "/c", "Council chat" }, + { 5, "/creategarage", "Creating a garage" }, + { 5, "/destroygarage", "Deletes a garage" }, + { 5, "/connectsong", "Changes the conneciton song" }, + { 5, "/discordurl", "Updating the discord invite URL" }, + { 5, "/creategate", "Creating a gate" }, + { 5, "/editgate", "Editing a gate" }, + { 5, "/acunban", "Unbanning a player from AC" }, + { 5, "/safeisbugged", "Debug command for robbery safes" }, + { 5, "/autovehrespawn", "Setting auto respawn for vehicles" }, + { 5, "/megaban", "The Mega Ban" }, + { 5, "/achangename", "Change a players name" }, + { 5, "/unbanip", "Unbanning a IP address" }, + { 5, "/unban", "Unban a player from the server" }, + { 5, "/doublexp", "Enable/disable double XP" }, + { 5, "/toggleviewpm", "Toggle to view private messages" }, + { 5, "/respawnallv", "Respawning all server vehicles" }, + { 5, "/reconnectchuff", "Reconnecting the ChuffSec NPC" }, + { 5, "/createbribe", "Creates a bribe" }, + { 5, "/destroybribe", "Deletes a bribe " }, + { 5, "/createcar", "Create owned vehicle" }, + { 5, "/destroycar", "Deletes owned vehicle" }, + { 5, "/stripcarmods", "Removing all vehicle modifications" }, + { 5, "/createhouse", "Creating a house" }, + { 5, "/destroyhouse", "Deleting a house" }, + { 5, "/hadminsell", "Selling a house (as admin)" }, + { 5, "/forceac", "Forcing a player to use SAMP-CAC" }, + { 5, "/createbusiness", "Creates a business" }, + { 5, "/destroybusiness", "Deletes a business" }, + { 5, "/seteventhost", "Setting event host to player" }, + { 5, "/weather", "Settings world weather" }, + + /* ** Level 6 Commands ** */ + { 6, "/reloadeditor", "Reloads object editer script" }, + { 6, "/createentrance", "Creates a entrance" }, + { 6, "/destroyentrance", "Deleting a entrance" }, + { 6, "/setgangleader", "Settings a player into a gang leader" }, + { 6, "/viewgangtalk", "Viewing gang chat" }, + { 6, "/broadcast", "Broadcasting a music stream" }, + { 6, "/setlevel", "Setting a players admin level " }, + { 6, "/setleveloffline", "Setting a players admin level offline" }, + { 6, "/svrstats", "Show server statistics" }, + { 6, "/playaction", "Playing a action" }, + { 6, "/playanimation", "Playing an animation" }, + { 6, "/updaterules", "Updating the server rules" }, + { 6, "/truncate", "Truncating a account" } + } +; + /* ** Commands ** */ CMD:acommands( playerid, params[ ] ) return cmd_acmds( playerid, params ); CMD:acmds( playerid, params[ ] ) +{ + if ( p_AdminLevel[ playerid ] < 1 ) + return SendError( playerid, ADMIN_COMMAND_REJECT ); + + szNormalString[ 0 ] = '\0'; + + for (new iPos = 1; iPos != 7; iPos ++) + { + format( szNormalString, sizeof( szNormalString ), "%sAdmin Level %d Commands\n", szNormalString, iPos ); + } + + ShowPlayerDialog( playerid, DIALOG_ADMIN_CMDS, DIALOG_STYLE_LIST, ""COL_PINK"Admin Commands", szNormalString, "Select", "Cancel" ); + return 1; +} + +/* ** Hooks ** */ + +hook OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] ) +{ + if ( dialogid == DIALOG_ADMIN_CMDS && response ) + { + szHugeString[ 0 ] = '\0'; + + new + level = ( listitem + 1 ); + + if ( p_AdminLevel[ playerid ] < level ) + return SendError( playerid, "You don't have permission to view these admin commands." ), cmd_acmds( playerid, "" ); + + for (new iLine = 0; iLine < sizeof( g_CommandData ); iLine ++ ) if ( g_CommandData[ iLine ][ E_LEVEL ] == level ) + { + format( szHugeString, sizeof( szHugeString ), "%s"COL_GREY"%s\t"COL_WHITE"%s\n", + szHugeString, + g_CommandData[ iLine ][ E_COMMAND ], + g_CommandData[ iLine ][ E_DESCRIPTION ]); + } + + ShowPlayerDialog( playerid, DIALOG_ADMIN_CMDS_BACK, DIALOG_STYLE_TABLIST, sprintf( ""COL_PINK"Admin Level %d Commands", level ), szHugeString, "Back", "" ); + return 1; + } + + else if ( dialogid == DIALOG_ADMIN_CMDS_BACK && response ) + { + return cmd_acmds( playerid, "" ), 1; + } + + return 1; +} + +/*CMD:acmds( playerid, params[ ] ) { if ( p_AdminLevel[ playerid ] < 1 ) return SendError( playerid, ADMIN_COMMAND_REJECT ); SendClientMessage( playerid, COLOR_GREY, "|______________________________________| Admin Commands |_____________________________________|" ); @@ -37,7 +252,7 @@ CMD:acmds( playerid, params[ ] ) SendClientMessage( playerid, COLOR_GREY, "|_____________________________________________________________________________________________|" ); return 1; -} +}*/ /* ** Modules ** */ #include "irresistible\cnr\commands\admin\admin_one.pwn"