add variable inifiles for activation

master
rubin 2 years ago
parent 8c3fc250ea
commit 5f9b743bae
  1. 40
      corn-hud.lua

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

Loading…
Cancel
Save