thetwistedpanda

Untitled

Aug 29th, 2013
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 6.44 KB | None | 0 0
  1. "BuildWars.Settings"
  2. {
  3.     //Rotation definitions available for clients to select from.
  4.     //Used when clients are rotating their prop, and snapping rotations when controlling props.
  5.     //Definition: "degrees" "default"
  6.     //* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  7.     "Rotations"
  8.     {
  9.         "1.40625"           "0"
  10.         "2.8125"            "0"
  11.         "5.625"             "0"
  12.         "11.25"             "0"
  13.         "22.5"              "0"
  14.         "45.0"              "1"
  15.         "90.0"              "0"
  16.     }
  17.  
  18.     //Position definitions available for clients to select from.
  19.     //Used when clients are moving props, and snapping positions when controlling props.
  20.     //Definition: "units" "default"
  21.     //* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  22.     "Positions"
  23.     {
  24.         "1.0"               "0"
  25.         "2.0"               "1"
  26.         "3.0"               "0"
  27.         "5.0"               "0"
  28.         "8.0"               "0"
  29.         "12.0"              "0"
  30.         "16.0"              "0"
  31.         "24.0"              "0"
  32.         "30.0"              "0"
  33.     }
  34.  
  35.     //Command definitions for determining how to access content of the plugin.
  36.     //Definitions with sm_ result in both ! and / being created for usage.
  37.     //Indexes:
  38.     //   0 - BuildWars Menu
  39.     //   1 - Rotate Prop Menu
  40.     //   2 - Move Prop Menu
  41.     //   3 - Delete Target Prop
  42.     //   4 - Control Target Prop
  43.     //   5 - Check Target Prop
  44.     //   6 - Return To Spawn
  45.     //   7 - Help Menu
  46.     //   8 - Ready Status
  47.     //   9 - Delete All Props
  48.     //  10 - Toggle Third Person
  49.     //  11 - Toggle Fly State
  50.     //  12 - Clone Target Prop / Clone Grabbed Prop
  51.     //  13 - Toggle Target Prop Phase
  52.     //Definition: "command" "index"
  53.     //* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  54.     "Commands"
  55.     {
  56.         "sm_prop"           "0"
  57.         "sm_props"          "0"
  58.         "sm_build"          "0"
  59.         "sm_rotate"         "1"
  60.         "sm_rot"            "1"
  61.         "sm_move"           "2"
  62.         "sm_pos"            "2"
  63.         "sm_position"       "2"
  64.         "sm_delete"         "3"
  65.         "sm_del"            "3"
  66.         "sm_grab"           "4"
  67.         "sm_control"        "4"
  68.         "sm_check"          "5"
  69.         "sm_trace"          "5"
  70.         "sm_tele"           "6"
  71.         "sm_stuck"          "6"
  72.         "sm_ztele"          "6"
  73.         "sm_zstuck"         "6"
  74.         "sm_help"           "7"
  75.         "sm_ready"          "8"
  76.         "sm_deleteall"      "9"
  77.         "sm_clear"          "9"
  78.         "sm_delall"         "9"
  79.         "sm_3rd"            "10"
  80.         "sm_third"          "10"
  81.         "sm_3rdperson"      "10"
  82.         "sm_thirdperson"    "10"
  83.         "sm_glide"          "11"
  84.         "sm_clone"          "12"
  85.         "sm_copy"           "12"
  86.         "sm_phase"          "13"
  87.         "sm_block"          "13"       
  88.     }
  89.    
  90.     //Punishment definitions for the Gimp feature (restricts plugin features for targeted players)
  91.     //Definition: "display" "seconds"
  92.     "Durations"
  93.     {
  94.         "5 Minutes"         "5"
  95.         "10 Minutes"        "10"
  96.         "15 Minutes"        "15"
  97.         "20 Minutes"        "20"
  98.         "30 Minutes"        "30"
  99.         "45 Minutes"        "45"
  100.         "60 Minutes"        "60"
  101.         "2 Hours"           "120"
  102.         "3 Hours"           "180"
  103.         "6 Hours"           "360"
  104.         "12 Hours"          "720"
  105.         "24 Hours"          "1440"
  106.         "2 Days"            "2880"
  107.         "3 Days"            "4320"
  108.         "4 Days"            "5760"
  109.         "5 Days"            "7200"
  110.         "6 Days"            "8640"
  111.         "7 Days"            "10080"
  112.     }
  113.    
  114.     //Valid classnames of entities that can be used as walls to separate the two teams.
  115.     //Definition: "classname" ""
  116.     "Walls"
  117.     {
  118.         "func_breakable"        ""
  119.         "func_breakable_surf"   ""
  120.         "func_brush"            ""
  121.         "func_wall_toggle"      ""
  122.     }
  123. }
  124.  
  125. Define_Settings()
  126. {
  127.     decl String:sPath[PLATFORM_MAX_PATH], String:sBuffer[64];
  128.     BuildPath(Path_SM, sPath, PLATFORM_MAX_PATH, "configs/buildwars/buildwars.settings.cfg");
  129.  
  130.     new iTemp, Handle:hKeyValues = CreateKeyValues("BuildWars.Settings");
  131.     if(!FileToKeyValues(hKeyValues, sPath) || !KvGotoFirstSubKey(hKeyValues))
  132.         SetFailState("BuildWars: Could not either locate or parse \"configs/buildwars/buildwars.settings.cfg\"");
  133.     else
  134.     {
  135.         do
  136.         {
  137.             KvGetSectionName(hKeyValues, sPath, sizeof(sPath));
  138.             if(StrEqual(sPath, "Rotations", false))
  139.             {
  140.                 g_iCfg_TotalRotations = 0;
  141.                 g_iCfg_DefaultRotation = -1;
  142.  
  143.                 KvGotoFirstSubKey(hKeyValues, false);
  144.                 do
  145.                 {
  146.                     KvGetSectionName(hKeyValues, sBuffer, sizeof(sBuffer));
  147.                     g_Cfg_fDefinedRotations[g_iCfg_TotalRotations] = StringToFloat(sBuffer);
  148.                     if((iTemp = KvGetNum(hKeyValues, NULL_STRING, 0)))
  149.                         g_iCfg_DefaultRotation = iTemp;
  150.  
  151.                     g_iCfg_TotalRotations++;
  152.                 }
  153.                 while (KvGotoNextKey(hKeyValues, false));
  154.                 if(g_iCfg_DefaultRotation == -1)
  155.                     g_iCfg_DefaultRotation = GetRandomInt(0, (g_iCfg_TotalRotations - 1));
  156.  
  157.                 KvGoBack(hKeyValues);
  158.             }
  159.             else if(StrEqual(sPath, "Positions", false))
  160.             {
  161.                 g_iCfg_TotalPositions = 0;
  162.                 g_iCfg_DefaultPosition = -1;
  163.  
  164.                 KvGotoFirstSubKey(hKeyValues, false);
  165.                 do
  166.                 {
  167.                     KvGetSectionName(hKeyValues, sBuffer, sizeof(sBuffer));
  168.                     g_Cfg_fDefinedPositions[g_iCfg_TotalPositions] = StringToFloat(sBuffer);
  169.                     if((iTemp = KvGetNum(hKeyValues, NULL_STRING, 0)))
  170.                         g_iCfg_DefaultPosition = iTemp;
  171.  
  172.                     g_iCfg_TotalPositions++;
  173.                 }
  174.                 while (KvGotoNextKey(hKeyValues, false));
  175.                 if(g_iCfg_DefaultPosition == -1)
  176.                     g_iCfg_DefaultPosition = GetRandomInt(0, (g_iCfg_TotalPositions - 1));
  177.  
  178.                 KvGoBack(hKeyValues);
  179.             }
  180.             else if(StrEqual(sPath, "Commands", false))
  181.             {
  182.                 ClearTrie(g_hTrie_CfgDefinedCmds);
  183.  
  184.                 KvGotoFirstSubKey(hKeyValues, false);
  185.                 do
  186.                 {
  187.                     KvGetSectionName(hKeyValues, sBuffer, sizeof(sBuffer));
  188.                     iTemp = KvGetNum(hKeyValues, NULL_STRING, 0);
  189.                     if(!StrContains(sBuffer, "sm_"))
  190.                     {
  191.                         strcopy(sPath, sizeof(sPath), sBuffer);
  192.                         ReplaceString(sPath, sizeof(sPath), "sm_", "!", false);
  193.                         SetTrieValue(g_hTrie_CfgDefinedCmds, sPath, iTemp);
  194.  
  195.                         strcopy(sPath, sizeof(sPath), sBuffer);
  196.                         ReplaceString(sPath, sizeof(sPath), "sm_", "/", false);
  197.                         SetTrieValue(g_hTrie_CfgDefinedCmds, sPath, iTemp);
  198.                     }
  199.                     else
  200.                         SetTrieValue(g_hTrie_CfgDefinedCmds, sBuffer, iTemp);
  201.                 }
  202.                 while (KvGotoNextKey(hKeyValues, false));
  203.  
  204.                 KvGoBack(hKeyValues);
  205.             }
  206.             else if(StrEqual(sPath, "Durations", false))
  207.             {
  208.                 g_iCfg_TotalDurations = 0;
  209.  
  210.                 KvGotoFirstSubKey(hKeyValues, false);
  211.                 do
  212.                 {
  213.                     KvGetSectionName(hKeyValues, g_Cfg_sGimpDisplays[g_iCfg_TotalDurations], sizeof(g_Cfg_sGimpDisplays[]));
  214.                     g_iCfg_GimpDurations[g_iCfg_TotalDurations] = KvGetNum(hKeyValues, NULL_STRING);
  215.  
  216.                     g_iCfg_TotalDurations++;
  217.                 }
  218.                 while (KvGotoNextKey(hKeyValues, false));
  219.  
  220.                 KvGoBack(hKeyValues);
  221.             }
  222.             else if(StrEqual(sPath, "Walls", false))
  223.             {
  224.                 KvGotoFirstSubKey(hKeyValues, false);
  225.                 do
  226.                 {
  227.                     KvGetSectionName(hKeyValues, sBuffer, sizeof(sBuffer));
  228.                     SetTrieValue(g_hTrie_CfgWalls, sBuffer, 1);
  229.  
  230.                     g_iCfg_TotalDurations++;
  231.                 }
  232.                 while (KvGotoNextKey(hKeyValues, false));
  233.  
  234.                 KvGoBack(hKeyValues);
  235.             }
  236.         }
  237.         while (KvGotoNextKey(hKeyValues));
  238.  
  239.         CloseHandle(hKeyValues);
  240.     }
  241. }
Advertisement
Add Comment
Please, Sign In to add comment