Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function GetKey2(Button,Gametype,Player)
- if FILEMAN:DoesFileExist("Save/Keymaps.ini") then
- local keyini = IniFile.ReadFile("Save/Keymaps.ini");
- str = string.match(keyini[Gametype][Player.."_"..Button], "Key_(.-):.");
- if str then
- return str;
- else
- return Button;
- end;
- else
- return Button;
- end;
- end;
- local function GetKey(Button,Gametype,Player)
- if FILEMAN:DoesFileExist("Save/Keymaps.ini") then
- local keyini = RageFileUtil.CreateRageFile();
- keyini:Open("Save/Keymaps.ini",1);
- keyread = keyini:Read();
- keyini:Close();
- local ReadChar = {};
- local TempChar;
- local i = 1;
- local v, v2, v3, v4, v5; -- I'm sorry :< -Jousway
- for c in string.gmatch(keyread,"(.-)%\n") do --change string in to lines and put them in table
- v = string.match(c, "%[%a+%]"); -- Find ini [], Example [dance]
- if v then -- check if [] exists
- TempChar = v; -- define [] as a temp local
- else
- v2 = string.match(c, "(.+=.+)"); -- check if = exist, Example Command=diffuse,1,1,1,1
- if v2 then -- check if = exists
- ReadChar[i] = TempChar..v2; -- make table with combine [] and = depending on [], Example [dance] 1_Left=Key_W
- i = i + 1;
- end;
- end;
- end;
- for c2=1,#ReadChar do -- for every ReadChar value do
- v3 = string.match(ReadChar[c2], "%[(.+)%].+"); -- define the v3 as the [] from ReadChar
- if v3 == Gametype then -- Check if [] is dance
- v4 = string.match(ReadChar[c2], "%[.+%](.+)="); -- grab the value before the = and define it
- if v4 == Player.."_"..Button then -- check if value before the = is Button
- v5 = string.match(ReadChar[c2], "%[.+%].+=Key_(.-):.");
- if v5 then
- return v5;
- else
- return Button;
- end;
- end;
- end;
- end;
- else
- return Button;
- end;
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement