diff --git a/corn-hud.lua b/corn-hud.lua index ad0bda2..5ca91af 100644 --- a/corn-hud.lua +++ b/corn-hud.lua @@ -20,7 +20,7 @@ local coord = { function main() if not isSampLoaded() or not isSampfuncsLoaded() then return end while not isSampAvailable() do wait(0) end - repeat + repeat wait(100) local res, id = sampGetPlayerIdByCharHandle(PLAYER_PED) nickname = sampGetPlayerNickname(id) @@ -35,7 +35,7 @@ function main() if hostName == "Samp-Rp.Ru Server 02 Client 0.3.7" then serverName = "Two" end if serverName == nil then thisScript():unload() end iniName = string.format("cornHUD-%s", serverName) - ini = inicfg.load({ + ini = inicfg.load({ ['Farm 0'] = { corn = 0, cornPrice = 0, @@ -85,7 +85,7 @@ function main() }, Settings = { Key1='VK_RBUTTON', - Key2='VK_C', + Key2='VK_MENU', X=0, Y=0 }, @@ -108,7 +108,7 @@ function main() while true do wait(0) points = '' - for k,v in pairs(coord) do + for k,v in pairs(coord) do local dist = math.floor(getDistanceBetweenCoords3d(v.x, v.y, v.z, getCharCoordinates(playerPed))) if dist <= 30 then points = k @@ -145,7 +145,7 @@ function main() end end end - if isKeyDown(VK_RBUTTON) and (isCharInModel(PLAYER_PED, 440) or isKeyDown(VK_C)) then + if isKeyDown(ini.Settings.Key1) and (isCharInModel(PLAYER_PED, 440) or isKeyDown(ini.Settings.Key2)) then sampSetCursorMode(3) mouse = 1 local posX, posY = getScreenResolution() @@ -164,12 +164,12 @@ function main() if i == 1 then render = not render end - if i == 2 then - if points ~= '' then + if i == 2 then + if points ~= '' then if points:find('Farm') then local warecorn = urojai local corn = ( (1500 - warecorn) < tonumber(ini[points].product) and (1500 - warecorn) or tonumber(ini[points].product) ) - sampSendChat('/cornmenu 2 '..corn) + sampSendChat('/cornmenu 2 '..corn) finfoCheck = 1 end if points:find('Zerno') then @@ -177,34 +177,34 @@ function main() end end end - if i == 3 then - if points ~= '' then + if i == 3 then + if points ~= '' then if points:find('Farm') then - sampSendChat('/cornmenu 1 '..(zerno > (10000 - ini[points].corn) and (10000 - ini[points].corn) or zerno)) - finfoCheck = 1 + sampSendChat('/cornmenu 1 '..(zerno > (10000 - ini[points].corn) and (10000 - ini[points].corn) or zerno)) + finfoCheck = 1 end if points:find('Narko') then - sampSendChat('/cornmenu 4 '..narko) + sampSendChat('/cornmenu 4 '..narko) end if points:find('Urojai') then - sampSendChat('/cornmenu 4 '..urojai) + sampSendChat('/cornmenu 4 '..urojai) end end end - if i == 4 then + if i == 4 then sampSendChat('/finfo') end if i == 5 then finfoCheck = 1 end end - + posY = posY + plus end else if mouse ~= nil and mouse == 1 then sampSetCursorMode(0) - mouse = nil + mouse = nil end end end @@ -277,7 +277,7 @@ function sampev.onSendChat(message) antiflood = os.clock() * 1000 end function sampev.onSendCommand(cmd) antiflood = os.clock() * 1000 end function CheckCoord() - for k,v in pairs(coord) do + for k,v in pairs(coord) do local dist = math.floor(getDistanceBetweenCoords3d(v.x, v.y, v.z, getCharCoordinates(playerPed))) if dist <= 30 then return k @@ -289,14 +289,14 @@ end function SetPos() lua_thread.create(function() wait(100) - repeat + repeat wait(0) pos = true sampSetCursorMode(3) local X, Y = getCursorPos() ini.Settings.X = X ini.Settings.Y = Y - inicfg.save(ini, iniName) + inicfg.save(ini, iniName) until isKeyJustPressed(1) sampSetCursorMode(0) wait(100)