remove unnecessary & update server detect

master
rubin 2 years ago
parent 5f9b743bae
commit 8166c35164
  1. 34
      corn-hud.lua

@ -20,21 +20,18 @@ 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(0) until sampGetCurrentServerName() ~= "SA-MP"
wait(100) repeat wait(0) until sampGetCurrentServerName():find("Samp%-Rp.Ru") or sampGetCurrentServerName():find("SRP")
local res, id = sampGetPlayerIdByCharHandle(PLAYER_PED) server = sampGetCurrentServerName():gsub("|", "")
nickname = sampGetPlayerNickname(id) server =
if res then score = sampGetPlayerScore(id) end (server:find("02") and "Two" or
until score > 0 (server:find("Revo") and "Revolution" or
local magicChar = { ":", "|" } (server:find("Legacy") and "Legacy" or (server:find("Classic") and "Classic" or
local hostName = sampGetCurrentServerName() (server:find("Zero Two") and "Two" or "")))))
for i = 1, #magicChar do hostName = hostName:gsub(magicChar[i], '') end if server == "" then
if string.find(hostName, "Legacy") then serverName = "Legacy" end thisScript():unload()
if string.find(hostName, "Reborn") then serverName = "Reborn" end end
if string.find(hostName, "Revolution") then serverName = "Revolution" end iniName = string.format("cornHUD-%s", server)
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'] = { ['Farm 0'] = {
corn = 0, corn = 0,
@ -91,13 +88,8 @@ function main()
}, },
}, iniName) }, iniName)
inicfg.save(ini, iniName) inicfg.save(ini, iniName)
sampfuncsLog(' {FFFFFF}corn-hud by Serhiy_Rubin loaded. CMD: /corn | /corn hud. | Key combo: '..ini.Settings.Key1:gsub("VK_", '')..' + '..ini.Settings.Key2:gsub("VK_", '')) sampfuncsLog(' {FFFFFF}corn-hud loaded. CMD: /corn | /corn hud. | Key combo: '..ini.Settings.Key1:gsub("VK_", '')..' + '..ini.Settings.Key2:gsub("VK_", ''))
font = renderCreateFont(ini.Render.FontName, ini.Render.FontSize, ini.Render.FontFlag) font = renderCreateFont(ini.Render.FontName, ini.Render.FontSize, ini.Render.FontFlag)
sampRegisterChatCommand('getcoord', function(param)
local x, y, z = getCharCoordinates(PLAYER_PED)
string = string.format("%0.2f, %0.2f, %0.2f", x, y, z)
setClipboardText(string)
end)
sampRegisterChatCommand('corn', function(param) sampRegisterChatCommand('corn', function(param)
if render and param:lower():find('pos') then if render and param:lower():find('pos') then
SetPos() SetPos()

Loading…
Cancel
Save