thetwistedpanda

Untitled

Aug 29th, 2013
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.70 KB | None | 0 0
  1. "Maps.Config"
  2. {
  3.     //Map Configuration File
  4.     //* * * * * * * * * * * * * * * * * * * * * * * * * * * * *  *  *  *  *  *  *  *  *  *  *  *  *
  5.     //"exact_map_name"
  6.     //{
  7.     //  "#" "execution" //#" *MUST* start at 1 and *MUST* increase by one for each following value.
  8.     //}
  9.     //- Any additional " must be replaced with \"
  10.     //* * * * * * * * * * * * * * * * * * * * * * * * * * * * *  *  *  *  *  *  *  *  *  *  *  *  *
  11.    
  12.     "testmap"
  13.     {
  14.         "cvar"  "value"
  15.         "cvar"  "value"
  16.         "cvar"  "value"
  17.         "cvar"  "value"
  18.         "cvar"  "value"
  19.     }
  20. }
  21.  
  22. ReadMapConfigs()
  23. {
  24.     decl String:sPath[PLATFORM_MAX_PATH];
  25.     BuildPath(Path_SM, sPath, sizeof(sPath), "configs/kvconfigs.maps.ini");
  26.  
  27.     g_bMapConfigs = false;
  28.     new iSize, Handle:hKeyValues = CreateKeyValues("KvConfigs.Maps");
  29.     if(FileToKeyValues(hKeyValues, sPath) && KvGotoFirstSubKey(hKeyValues))
  30.     {
  31.         g_bMapConfigs = true;
  32.  
  33.         do
  34.         {
  35.             iSize = GetArraySize(g_hArray_MapCvars);
  36.             KvGetSectionName(hKeyValues, sPath, sizeof(sPath));
  37.                
  38.             SetTrieValue(g_hTrie_MapCvars, sPath, iSize);
  39.             ResizeArray(g_hArray_MapCvars, iSize + 1);
  40.  
  41.             new Handle:hCvar = CreateArray(64);
  42.             new Handle:hAction = CreateArray(64);
  43.  
  44.             if(KvGotoFirstSubKey(hKeyValues, false))
  45.             {
  46.                 do
  47.                 {
  48.                     KvGetSectionName(hKeyValues, sPath, sizeof(sPath));
  49.                     PushArrayString(hCvar, sPath);
  50.  
  51.                     KvGetString(hKeyValues, NULL_STRING, sPath, sizeof(sPath));
  52.                     PushArrayString(hAction, sPath);
  53.                 }
  54.                 while (KvGotoNextKey(hKeyValues, false));
  55.                 KvGoBack(hKeyValues);
  56.             }
  57.  
  58.             SetArrayCell(g_hArray_MapCvars, iSize, hCvar, 0);
  59.             SetArrayCell(g_hArray_MapCvars, iSize, hAction, 1);
  60.         }
  61.         while (KvGotoNextKey(hKeyValues));
  62.  
  63.         CloseHandle(hKeyValues);
  64.     }
  65.    
  66.     return iSize;
  67. }
Advertisement
Add Comment
Please, Sign In to add comment