////////////////////////////////////////
// WCS - Warcraft:Source              //
// ---------------------------------- //
//  by kRypT0n!Te                     //
//      http://wcs.despo-clan.de      //
// ---------------------------------- //
// Content of this subscript          //
// - admin menu                       //
////////////////////////////////////////
// say commands:
// wcsadmin
//
// admin commands:
// wcs_admin1_menu <userid>
// wcs_admin2_menu <userid> <targetid>
// wcsadmin
//
////////////////////////////////////////

block load
{
  es_xexists wcs_exists command wcs_admin1_menu
  es es_xif (server_var(wcs_exists) = 0) then es_xregcmd wcs_admin1_menu wcs/WCSadmin/wcs_admin1_menu "wcs_admin1_menu - usage: wcs_admin1_menu <userid>"
  es_xexists wcs_exists command wcs_admin2_menu
  es es_xif (server_var(wcs_exists) = 0) then es_xregcmd wcs_admin2_menu wcs/WCSadmin/wcs_admin2_menu "wcs_admin2_menu - usage: wcs_admin2_menu <userid> <targetid>"
  es_xexists wcs_exists command wcs_admin_setting
  es es_xif (server_var(wcs_exists) = 0) then es_xregcmd wcs_admin_setting wcs/WCSadmin/wcs_admin_setting "wcs_admin_setting - usage: wcs_admin_setting <userid>"
  es_xexists wcs_exists command wcsadmin
  es es_xif (server_var(wcs_exists) = 0) then es_xregsaycmd wcsadmin wcs/WCSadmin/wcs_admincheck "Admin player management"
  es_xregclientcmd wcsadmin wcs/WCSadmin/wcs_admincheck "Admin player management"
}

event server
{
	// reload the admins
	es_xkeygroupdelete "WCSadmin"
	es_xkeygroupload "WCSadmin" "|wcs/WCSadmin"
	//es_xformat wcs_admins ""
	//es_xforeachkey wcs_key in WCSadmin "es es_xformat wcs_admins %1<%2> server_var(wcs_admins) server_var(wcs_key)"
}

// >>>>>>>>>>>>>>>>> ADMIN STUFF >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
block wcs_admincheck
{
es es_xif (server_var(wcs_debug) = "1") then echo wcs_admincheck start
  // who started the command
  es_xgetcmduserid wcs_userid
  es es_xkeygetvalue wcs_id "WCSuserdata" server_var(wcs_userid) "id"
  // check for admin
  es_xsetinfo wcs_isadmin "0"
  es es_xexists wcs_isadmin key "WCSadmin" server_var(wcs_id)
  es es_xif (server_var(wcs_isadmin) = "1") do
  {
    es es_xexists wcs_exists key "WCSuserdata" server_var(wcs_userid)
    es es_xif (server_var(wcs_exists) = "1") do
    {
    	es wcs_menuzero server_var(wcs_userid)
      es wcs_admin1_menu server_var(wcs_userid)
    }
  }
  es_xelse do
  {
  	wcs_getlanguage "wcs_lng" "wcs_lng_noadmin"
    es es_xtell server_var(wcs_userid) #multi server_var(wcs_lng)
  }
es es_xif (server_var(wcs_debug) = "1") then echo wcs_admincheck end
}

block wcs_admin1_menu
{
es es_xif (server_var(wcs_debug) = "1") then echo wcs_admin1_menu start
  // a custom command
  es_xsetinfo wcs_userid 0
  es_xgetargv wcs_userid 1
  es es_xexists wcs_exists userid server_var(wcs_userid)
  es es_xif (server_var(wcs_exists) = 1) do
  {
  	wcs_getlanguage "wcs_lng" "wcs_lng_selectplayer"
    es es_xformat wcs_text "%1:\n" server_var(wcs_lng)
    es_xsetinfo wcs_page 0
    es es_xkeygetvalue wcs_page "WCSuserdata" server_var(wcs_userid) "page"
    es_xmath wcs_page + 1
    es es_xkeysetvalue "WCSuserdata" server_var(wcs_userid) "page" server_var(wcs_page)
    es es_xkeysetvalue "WCSuserdata" server_var(wcs_userid) "menu" "admin1"
    es_xsetinfo wcs_upper 6
    es_xsetinfo wcs_lower 0
    es es_xmath wcs_upper * server_var(wcs_page)
    es_xcopy wcs_lower wcs_upper
    es_xmath wcs_lower - 6
    es_xsetinfo wcs_counter 1
    es_xsetinfo wcs_playercount 0
    es es_xformat wcs_text "%1 %2\n " server_var(wcs_lng_page) server_var(wcs_page)
    es es_xforeachkey wcs_key in WCSuserdata "es es_xif(server_var(wcs_counter) > server_var(wcs_lower)) then es_xif (server_var(wcs_counter) <= server_var(wcs_upper)) then es_xdoblock wcs/WCSadmin/wcs_admin1_init;es_xmath wcs_counter + 1"
    wcs_getlanguage "wcs_lng" "wcs_lng_wcssettings"
    es es_xformat wcs_text "\n %1\n \n->7. %2" server_var(wcs_text) server_var(wcs_lng)
    es es_xif (server_var(wcs_page) > 1) then es_xformat wcs_text "%1\n->8. %2" server_var(wcs_text) server_var(wcs_lng_back)
    es es_xif (server_var(wcs_counter) > server_var(wcs_upper)) then es_xformat wcs_text "%1\n->9. %2" server_var(wcs_text) server_var(wcs_lng_next)
    es es_xformat wcs_text "%1\n->0. %2" server_var(wcs_text) server_var(wcs_lng_exit)
    es es_xstrlen wcs_strlen server_var(wcs_text)
    es es_xif (server_var(wcs_strlen) > 1) then es_xmenu 0 server_var(wcs_userid) server_var(wcs_text)
  }
es es_xif (server_var(wcs_debug) = "1") then echo wcs_admin1_menu end
}

block wcs_admin1_init
{
  es es_xexists wcs_exists userid server_var(wcs_key)
  es es_xif (server_var(wcs_exists) = "1") do
  {
    es_xmath wcs_playercount + 1
    es es_xgetplayername wcs_name server_var(wcs_key)
    es es_xkeygetvalue wcs_race "WCSuserdata" server_var(wcs_key) "race"
    es es_xkeygetvalue wcs_level "WCSuserdata" server_var(wcs_key) "level"
    wcs_getlanguage "wcs_lng" "wcs_lng_level"
    es es_xformat wcs_text "%1\n->%2. %3 (%4 %5)" server_var(wcs_text) server_var(wcs_playercount) server_var(wcs_name) server_var(wcs_lng) server_var(wcs_level)
  }
}

block wcs_admin1_handle
{
es es_xif (server_var(wcs_debug) = "1") then echo wcs_admin1_handle start
  // handle admin menu commands
  es_xsetinfo wcs_page 0
  es es_xkeygetvalue wcs_page "WCSuserdata" event_var(userid) "page"
  // reset the menu
  es es_xkeysetvalue "WCSuserdata" event_var(userid) "menu" "0"
  // handle back
  es es_xif (event_var(commandstring) = "8") do
  {
    es es_xif (server_var(wcs_page) > 1) do
    {
      es_xmath wcs_page - 2
      es es_xkeysetvalue WCSuserdata event_var(userid) page server_var(wcs_page)
      es wcs_admin1_menu event_var(userid)
    }
  }
  // handle next
  es es_xif (event_var(commandstring) = "9") do
  {
  	es_xsetinfo wcs_next 0
    es_xgetplayercount wcs_playercount
    es_xcopy wcs_tmp wcs_page
    es_xmath wcs_tmp * 6
    es es_xif (server_var(wcs_playercount) > server_var(wcs_tmp)) do
    {
    	es_xmath wcs_page + 1
      es wcs_admin1_menu event_var(userid)
    }
  }
  // handle settings
  es es_xif (event_var(commandstring) = "7") do
  {
  	es es_xkeygetvalue wcs_id "WCSuserdata" event_var(userid) "id"
  	es_xsetinfo wcs_isadmin "0"
    es es_xexists wcs_exists key "WCSadmin" server_var(wcs_id)
  	es es_xif (server_var(wcs_exists) = "1") then es_xkeygetvalue wcs_isadmin "WCSadmin" server_var(wcs_id) "script_settings"
    es es_xif (server_var(wcs_isadmin) = "1") do
    {
    	es wcs_admin_setting event_var(userid)
    }
    es_xelse do
    {
    	wcs_getlanguage "wcs_lng" "wcs_lng_noright"
      es es_xtell event_var(userid) #multi server_var(wcs_lng)
    }
  }
  es es_xif (event_var(commandstring) < 7) do
  {
    es es_xif (event_var(commandstring) > 0) do
    {
    	es_xcopy wcs_target wcs_page
		  es_xmath wcs_target * 6
 		  es_xmath wcs_target - 6
 		  es es_xmath wcs_target + event_var(commandstring)
		  es_xsetinfo wcs_scounter 1
 		  es_xforeachkey wcs_key in "WCSuserdata" "es es_xif (server_var(wcs_target) = server_var(wcs_scounter)) then wcs_admin2_menu event_var(userid) server_var(wcs_key);es_xmath wcs_scounter + 1"
    }
  }
es es_xif (server_var(wcs_debug) = "1") then echo wcs_admin1_handle end
}

block wcs_admin2_menu
{
es es_xif (server_var(wcs_debug) = "1") then echo wcs_admin2_menu start
  // a custom command
  es_xsetinfo wcs_userid 0
  es_xgetargv wcs_userid 1
  es_xsetinfo wcs_targetid 0
  es_xgetargv wcs_targetid 2
  es es_xexists wcs_exists userid server_var(wcs_userid)
  es es_xif (server_var(wcs_exists) = 1) do
  {
    es es_xexists wcs_exists userid server_var(wcs_targetid)
    es es_xif (server_var(wcs_exists) = 1) do
    {
      es es_xkeygetvalue wcs_id "WCSuserdata" server_var(wcs_targetid) "id"
      es es_xgetplayername wcs_name server_var(wcs_targetid)
      wcs_getlanguage "wcs_lng" "wcs_lng_adminmenu2"
      es es_xformat wcs_text "%1\n  %2\n \n %3\n 8. %4\n \n 0. %5" server_var(wcs_id) server_var(wcs_name) server_var(wcs_lng) server_var(wcs_lng_back) server_var(wcs_lng_exit)
      es es_xmenu "0" server_var(wcs_userid) server_var(wcs_text)
      es es_xkeysetvalue WCSuserdata server_var(wcs_userid) "targetid" server_var(wcs_targetid)
      es es_xkeysetvalue WCSuserdata server_var(wcs_userid) "menu" "admin2"
    }
  }
es es_xif (server_var(wcs_debug) = "1") then echo wcs_admin2_menu end
}

block wcs_admin2_handle
{
es es_xif (server_var(wcs_debug) = "1") then echo wcs_admin2_handle start
  es_xsetinfo wcs_targetid 0
  es es_xkeygetvalue wcs_targetid "WCSuserdata" event_var(userid) "targetid"
es es_xgetplayername wcs_name event_var(userid)
es_xsetinfo wcs_tmp2 0
es es_xif (server_var(wcs_targetid) != 0) then es_xgetplayername wcs_tmp2 server_var(wcs_targetid)
es echo [WCSadmin] : server_var(wcs_name) used admin menu, pressed key event_var(commandstring) target: server_var(wcs_tmp2)
  es es_xkeygetvalue wcs_sid "WCSuserdata" event_var(userid) "id"
  // reset the menu
  es es_xkeysetvalue "WCSuserdata" event_var(userid) "menu" "0"
  // execute the levelup from the admin menu
  es es_xexists wcs_exists userid server_var(wcs_targetid)
  es es_xif (server_var(wcs_exists) = 1) do
  {
  	// get the ID
    es es_xkeygetvalue wcs_id WCSuserdata server_var(wcs_targetid) "id"
    es_xsetinfo wcs_name 0
    es es_xgetplayername wcs_name server_var(wcs_targetid)
    // the admin numbers
    es es_xif (event_var(commandstring) = "1") do
    {
    	es es_xkeygetvalue wcs_isadmin "WCSadmin" server_var(wcs_sid) "give_xp_level"
    	es es_xif (server_var(wcs_isadmin) = "1") do
    	{
	    	wcs_getlanguage "wcs_lng" "wcs_lng_admin_givexp"
	      es es_xformat wcs_text server_var(wcs_lng) event_var(es_username) server_var(wcs_name) "200"
	      es es_xtell server_var(wcs_targetid) #multi server_var(wcs_text)
	      es es_xif (server_var(wcs_targetid) != event_var(userid)) then es_xtell event_var(userid) #multi server_var(wcs_text)
	      es wcs_givexp server_var(wcs_targetid) "200" "0" "1"
	      es wcs_admin2_menu event_var(userid) server_var(wcs_targetid)
      }
      es_xelse do
      {
      	wcs_getlanguage "wcs_lng" "wcs_lng_noright"
      	es es_xtell event_var(userid) #multi server_var(wcs_lng)
      }
    }
    es es_xif (event_var(commandstring) = "2") do
    {
    	es es_xkeygetvalue wcs_isadmin "WCSadmin" server_var(wcs_sid) "give_xp_level"
    	es es_xif (server_var(wcs_isadmin) = "1") do
    	{
	    	wcs_getlanguage "wcs_lng" "wcs_lng_admin_givexp"
	      es es_xformat wcs_text server_var(wcs_lng) event_var(es_username) server_var(wcs_name) "1000"
	      es es_xtell server_var(wcs_targetid) #multi server_var(wcs_text)
	      es es_xif (server_var(wcs_targetid) != event_var(userid)) then es_xtell event_var(userid) #multi server_var(wcs_text)
	      es wcs_givexp server_var(wcs_targetid) "1000" "0" "1"
	      es wcs_admin2_menu event_var(userid) server_var(wcs_targetid)
      }
      es_xelse do
      {
      	wcs_getlanguage "wcs_lng" "wcs_lng_noright"
      	es es_xtell event_var(userid) #multi server_var(wcs_lng)
      }
    }
    es es_xif (event_var(commandstring) = "3") do
    {
    	es es_xkeygetvalue wcs_isadmin "WCSadmin" server_var(wcs_sid) "give_xp_level"
    	es es_xif (server_var(wcs_isadmin) = "1") do
    	{
	    	wcs_getlanguage "wcs_lng" "wcs_lng_admin_givelevel"
	      es es_xformat wcs_text server_var(wcs_lng) event_var(es_username) server_var(wcs_name) "2"
	      es es_xtell server_var(wcs_targetid) #multi server_var(wcs_text)
				es es_xif (server_var(wcs_targetid) != event_var(userid)) then es_xtell event_var(userid) #multi server_var(wcs_text)
				es wcs_givelevel server_var(wcs_targetid) "2" "0" "1"
	      es wcs_admin2_menu event_var(userid) server_var(wcs_targetid)
      }
      es_xelse do
      {
      	wcs_getlanguage "wcs_lng" "wcs_lng_noright"
      	es es_xtell event_var(userid) #multi server_var(wcs_lng)
      }
    }
    es es_xif (event_var(commandstring) = "4") do
    {
    	es es_xkeygetvalue wcs_isadmin "WCSadmin" server_var(wcs_sid) "take_level"
    	es es_xif (server_var(wcs_isadmin) = "1") do
    	{
    	  // set player one level lower
    	  es es_xkeygetvalue wcs_level "WCSuserdata" server_var(wcs_targetid) "level"
    	  es es_xif (server_var(wcs_level) > 0) do
    	  {
	    	  es es_xkeygetvalue wcs_race "WCSuserdata" server_var(wcs_targetid) "race"
	    	  es es_xkeygetvalue wcs_total_level "WCSuserdata" server_var(wcs_targetid) "total_level"
	    	  es_xsetinfo wcs_counter "0"
	        es es_xkeygetvalue wcs_numberofskills "WCSraces" server_var(wcs_race) "numberofskills"
	        es es_xif (server_var(wcs_numberofskills) != "0") then while "server_var(wcs_counter) <= server_var(wcs_numberofskills)" "es es_xformat wcs_skillnumber skill_%1 server_var(wcs_counter);es es_xkeysetvalue WCSuserdata server_var(wcs_targetid) server_var(wcs_skillnumber) 0;es_xmath wcs_counter + 1"
	        es_xmath wcs_level - 1
	        es_xmath wcs_total_level - 1
	        es es_xkeysetvalue "WCSuserdata" server_var(wcs_targetid) "xp" "0"
	        es es_xkeysetvalue "WCSuserdata" server_var(wcs_targetid) "level" server_var(wcs_level)
	        es es_xkeysetvalue "WCSuserdata" server_var(wcs_targetid) "total_level" server_var(wcs_total_level)
	        es es_xkeysetvalue "WCSuserdata" server_var(wcs_targetid) "unused" server_var(wcs_level)
	        wcs_getlanguage "wcs_lng" "wcs_lng_admin_takelevel"
	        es es_xformat wcs_text server_var(wcs_lng) event_var(es_username) "1" server_var(wcs_name)
	        es es_xtell server_var(wcs_targetid) #multi server_var(wcs_text)
	        es es_xif (server_var(wcs_targetid) != event_var(userid)) then es_xtell event_var(userid) #multi server_var(wcs_text)
	        es wcs_saveplayer server_var(wcs_targetid)
	        es es_xkeysetvalue "WCSuserdata" server_var(wcs_targetid) "skillcheck" "1"
	        es wcs_admin2_menu event_var(userid) server_var(wcs_targetid)
	      }
      }
      es_xelse do
      {
      	wcs_getlanguage "wcs_lng" "wcs_lng_noright"
      	es es_xtell event_var(userid) #multi server_var(wcs_lng)
      }
    }
    es es_xif (event_var(commandstring) = "5") do
    {
    	es es_xkeygetvalue wcs_isadmin "WCSadmin" server_var(wcs_sid) "give_money"
    	es es_xif (server_var(wcs_isadmin) = "1") do
    	{
	    	wcs_getlanguage "wcs_lng" "wcs_lng_admin_givecash"
	      es es_xformat wcs_text server_var(wcs_lng) event_var(es_username) server_var(wcs_name) "5000"
	      es es_xif (server_var(wcs_game) = server_var(wcs_game_css)) then est_Cash server_var(wcs_targetid) + 5000
	      es es_xif (server_var(wcs_game) != server_var(wcs_game_css)) then wcs_givecredits server_var(wcs_targetid) "5000" server_var(wcs_text) "1"
	      es es_xif (server_var(wcs_targetid) != event_var(userid)) then es_xtell event_var(userid) #multi server_var(wcs_text)
	      es es_xtell server_var(wcs_targetid) #multi server_var(wcs_text)
	      es wcs_admin2_menu event_var(userid) server_var(wcs_targetid)
	    }
	    es_xelse do
      {
      	wcs_getlanguage "wcs_lng" "wcs_lng_noright"
      	es es_xtell event_var(userid) #multi server_var(wcs_lng)
      }
    }
    es es_xif (event_var(commandstring) = "6") do
    {
    	es es_xkeygetvalue wcs_isadmin "WCSadmin" server_var(wcs_sid) "reset_player"
    	es es_xif (server_var(wcs_isadmin) = "1") do
    	{
    		es es_xkeygetvalue wcs_tmp "WCSuserdata" event_var(userid) "confirm"
	      es es_xif (server_var(wcs_tmp) = "0") do
	      {
	      	wcs_getlanguage "wcs_lng" "wcs_lng_adminagain"
	        es es_xtell event_var(userid) #multi server_var(wcs_lng)
	        es es_xkeysetvalue "WCSuserdata" event_var(userid) "confirm" "1"
	        es wcs_admin2_menu event_var(userid) server_var(wcs_targetid)
	      }
	      es_xelse do
	      {
		      es es_xkeygetvalue wcs_race "WCSuserdata" server_var(wcs_targetid) "race"
		      es_xsetinfo wcs_counter "0"
		      es es_xkeygetvalue wcs_level "WCSuserdata" server_var(wcs_targetid) "level"
		      es es_xkeygetvalue wcs_total_level "WCSuserdata" server_var(wcs_targetid) "total_level"
		      es es_xmath wcs_total_level - server_var(wcs_level)
		      es es_xkeygetvalue wcs_numberofskills "WCSraces" server_var(wcs_race) "numberofskills"
		      es es_xif (server_var(wcs_numberofskills) != "0") then while "server_var(wcs_counter) <= server_var(wcs_numberofskills)" "es es_xformat wcs_skillnumber skill_%1 server_var(wcs_counter);es es_xkeysetvalue WCSuserdata server_var(wcs_targetid) server_var(wcs_skillnumber) 0;es_xmath wcs_counter + 1"
		      es es_xkeysetvalue "WCSuserdata" server_var(wcs_targetid) "xp" "0"
		      es es_xkeysetvalue "WCSuserdata" server_var(wcs_targetid) "level" "0"
		      es es_xkeysetvalue "WCSuserdata" server_var(wcs_targetid) "unused" "0"
		      es es_xkeysetvalue "WCSuserdata" server_var(wcs_targetid) "total_level" server_var(wcs_total_level)
		      es wcs_saveplayer server_var(wcs_targetid)
		      wcs_getlanguage "wcs_lng" "wcs_lng_playerreset"
		      es es_xtell server_var(wcs_targetid) #multi server_var(wcs_lng)
		      wcs_getlanguage "wcs_lng" "wcs_lng_youerased"
		      wcs_getlanguage "wcs_lng2" "wcs_lng_skills"
		      wcs_getlanguage "wcs_lng3" "wcs_lng_level"
		      es es_xformat wcs_text "#lightgreen%1 #green%2 's #lightgreenXP, %3, %4." server_var(wcs_lng) server_var(wcs_name) server_var(wcs_lng2) server_var(wcs_lng3)
		      es es_xtell event_var(userid) #multi server_var(wcs_text)
		      es es_xkeysetvalue "WCSuserdata" server_var(wcs_targetid) "skillcheck" "1"
		    }
	    }
	    es_xelse do
      {
      	wcs_getlanguage "wcs_lng" "wcs_lng_noright"
      	es es_xtell event_var(userid) #multi server_var(wcs_lng)
      }
    }
    es es_xif (event_var(commandstring) = "7") do
    {
    	es es_xkeygetvalue wcs_isadmin "WCSadmin" server_var(wcs_sid) "reset_player"
    	es es_xif (server_var(wcs_isadmin) = "1") do
    	{
    		es es_xkeygetvalue wcs_tmp "WCSuserdata" event_var(userid) "confirm"
	      es es_xif (server_var(wcs_tmp) = "0") do
	      {
	      	wcs_getlanguage "wcs_lng" "wcs_lng_adminagain"
	        es es_xtell event_var(userid) #multi server_var(wcs_lng)
	        es es_xkeysetvalue "WCSuserdata" event_var(userid) "confirm" "1"
	        es wcs_admin2_menu event_var(userid) server_var(wcs_targetid)
	      }
	      es_xelse do
	      {
	        // get user id
	        es es_xkeygetvalue wcs_id "WCSuserdata" server_var(wcs_targetid) "id"
	        es es_xkeydelete "WCSuserdata" server_var(wcs_targetid)
	        es es_xkeycreate WCSuserdata server_var(wcs_targetid)
	        es es_xkeydelete WCSusers server_var(wcs_id)
	        es es_xkeycreate WCSusers server_var(wcs_id)
	        es_xdoblock wcs/WCSfunctions/wcs_playercheck
	        es es_xkeysetvalue WCSuserdata server_var(wcs_targetid) "id" server_var(wcs_id)
	        es es_xkeysetvalue WCSuserdata server_var(wcs_targetid) "race" "1"
	        es es_xkeysetvalue WCSuserdata server_var(wcs_targetid) "level" "0"
	        es es_xkeysetvalue WCSuserdata server_var(wcs_targetid) "total_level" "0"
	        es es_xkeysetvalue WCSuserdata server_var(wcs_targetid) "xp" "0"
	        es es_xkeysetvalue WCSuserdata server_var(wcs_targetid) "unused" "0"
	        wcs_getlanguage "wcs_lng" "wcs_lng_playerreset"
	        es es_xtell server_var(wcs_targetid) #multi server_var(wcs_lng)
	        wcs_getlanguage "wcs_lng" "wcs_lng_youerased"
	        wcs_getlanguage "wcs_lng2" "wcs_lng_skills"
	        wcs_getlanguage "wcs_lng3" "wcs_lng_level"
	        es es_xformat wcs_text "#lightgreen%1 #green%2 's #lightgreenXP, %3, %4." server_var(wcs_lng) server_var(wcs_name) server_var(wcs_lng2) server_var(wcs_lng3)
	        es es_xtell event_var(userid) #multi server_var(wcs_text)
	        es es_xkeysetvalue "WCSuserdata" server_var(wcs_targetid) "skillcheck" "1"
	      }
	    }
	    es_xelse do
      {
      	wcs_getlanguage "wcs_lng" "wcs_lng_noright"
      	es es_xtell event_var(userid) #multi server_var(wcs_lng)
      }
    }
    // handle 'back'
    es_xsetinfo wcs_page 0
    es es_xif (event_var(commandstring) = "8") do
    {
      es es_xkeygetvalue wcs_page "WCSuserdata" event_var(userid) "page"
      es_xmath wcs_page - 1
      es es_xkeysetvalue "WCSuserdata" event_var(userid) "page" server_var(wcs_page)
      es wcs_admin1_menu event_var(userid)
    }
  }
es es_xif (server_var(wcs_debug) = "1") then echo wcs_admin2_handle end
}
// <<<<<<<<<<<<<<<<< END ADMIN STUFF <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

block wcs_admin_setting
{
	es_xsetinfo wcs_userid 0
  es_xgetargv wcs_userid 1
  es es_xexists wcs_exists userid server_var(wcs_userid)
  es es_xif (server_var(wcs_exists) = 1) do
  {
  	es es_xkeysetvalue "WCSuserdata" event_var(userid) "page" "0"
    es es_xkeysetvalue "WCSuserdata" event_var(userid) "menu" "admin3"
    wcs_getlanguage "wcs_lng" "wcs_lng_adminmenu_setting"
    es es_xformat wcs_lng server_var(wcs_lng) server_var(mp_friendlyfire)
  	es es_xmenu "0" server_var(wcs_userid) server_var(wcs_lng)
  }
}

block wcs_admin_setting_handling
{
es es_xif (server_var(wcs_debug) = "1") then echo wcs_admin_setting_handle start
  es wcs_menuzero event_var(userid)
  es es_xif (event_var(commandstring) = "1") do
  {
  	wcs_getlanguage "wcs_lng" "wcs_lng_adminallxp_p"
    es_xforeachkey wcs_key in "WCSuserdata" "es wcs_givexp server_var(wcs_key) 500 server_var(wcs_lng) 1"
    wcs_getlanguage "wcs_lng" "wcs_lng_adminallxp"
    es es_xmsg #multi server_var(wcs_lng)
  }
  es es_xif (event_var(commandstring) = "2") do
  {
  	wcs_cleartop10
  	wcs_getlanguage "wcs_lng" "wcs_lng_cleartop10"
  	es es_xmsg #multi server_var(wcs_lng)
  }
  es es_xif (event_var(commandstring) = "3") do
  {
  	es es_xif (server_var(mp_friendlyfire) = "0") do
  	{
  		mp_friendlyfire "1"
  	}
  	es_xelse do
  	{
  		mp_friendlyfire "0"
  	}
  	wcs_getlanguage "wcs_lng" "wcs_lng_changedff"
  	es es_xmsg #multi server_var(wcs_lng)
  	es_xsetinfo wcs_adminff "1"
  }
  es es_xif (event_var(commandstring) = "4") do
  {
  	wcs_getlanguage "wcs_lng" "wcs_lng_modunload"
  	es es_xmsg #multi server_var(wcs_lng)
  	es_xdelayed 2 es_xunload wcs
  }
  es es_xif (event_var(commandstring) = "5") do
  {
  	wcs_getlanguage "wcs_lng" "wcs_lng_modreload"
  	es es_xmsg #multi server_var(wcs_lng)
  	es es_xif (server_var(wcs_game) = server_var(wcs_game_css)) then es_xdelayed 15 changelevel de_dust2
  	es es_xif (server_var(wcs_game) = server_var(wcs_game_dods)) then es_xdelayed 15 changelevel dod_flash
  	wcs_reload "all"
  }
es es_xif (server_var(wcs_debug) = "1") then echo wcs_admin_setting_handle end
}