Pedro001

Members
  • Content Count

    26
  • Joined

  • Last visited

Community Reputation

0 Neutral

About Pedro001

  • Rank
    Advanced Member

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Please, Could someone help me find out why can't players buy the properties in this script? I mean, part of it works just fine, I can create the properties, and everything is ok, but the other players on the server, can't buy the properties, because the windows won't pop up for them when they press the letter N. I went through the script and I can't figure out why this happens. core.client.lua local screen_width, screen_height = GuiElement.getScreenSize(); local is_cursor_over_gui = false; local action; local settings = {}; GuiElement.setInputMode("no_binds_when_editing"); addEvent("business.showCreateBusinessWindow", true); addEventHandler("business.showCreateBusinessWindow", root, function() gui.cb.window.visible = true; showCursor(true); end ); function outputMessage(message, r, g, b) triggerServerEvent("business.outputMessage", localPlayer, message, r, g, b); end addEventHandler("onClientRender", root, function() for index, b_marker in ipairs(Element.getAllByType("marker", resourceRoot)) do local b_data = b_marker:getData("b_data"); local id, name, owner, cost, payout, payout_time, payout_otime, payout_unit, bank, timer = unpack(b_data); local x, y, z = b_marker.position.x, b_marker.position.y, b_marker.position.z; local cam_x, cam_y, cam_z = getCameraMatrix(); if getDistanceBetweenPoints3D(cam_x, cam_y, cam_z, x, y, z) < 15 then local screen_x, screen_y = getScreenFromWorldPosition(x, y, z + 1.6); if screen_x then local scale = 1920 / screen_width; local width = 80 / scale; dxDrawImage(screen_x - width / 2, screen_y - screen_height / 10, width, 80, "files/business.png"); end if settings.show_business_info_on_marker then screen_x, screen_y = getScreenFromWorldPosition(x, y, z + 1.4); if screen_x then if #tostring(id) == 1 then id = "0"..tostring(id) end dxDrawFramedText("ID: #"..id, screen_x, screen_y, screen_x, screen_y, tocolor(255, 255, 255, 255), 1.0, "default-bold", "center", "center", false, false, false); end screen_x, screen_y = getScreenFromWorldPosition(x, y, z + 1.2); if screen_x then dxDrawFramedText("Nome: "..name, screen_x, screen_y, screen_x, screen_y, tocolor(255, 255, 255, 255), 1.0, "default-bold", "center", "center", false, false, false); end screen_x, screen_y = getScreenFromWorldPosition(x, y, z + 1.0); if screen_x then dxDrawFramedText("Dono: "..owner, screen_x, screen_y, screen_x, screen_y, tocolor(255, 255, 255, 255), 1.0, "default-bold", "center", "center", false, false, false); end screen_x, screen_y = getScreenFromWorldPosition(x, y, z + 0.8); if screen_x then dxDrawFramedText("Custo: $"..cost, screen_x, screen_y, screen_x, screen_y, tocolor(255, 255, 255, 255), 1.0, "default-bold", "center", "center", false, false, false); end screen_x, screen_y = getScreenFromWorldPosition(x, y, z + 0.6); if screen_x then dxDrawFramedText("Pagamento: $"..payout, screen_x, screen_y, screen_x, screen_y, tocolor(255, 255, 255, 255), 1.0, "default-bold", "center", "center", false, false, false); end screen_x, screen_y = getScreenFromWorldPosition(x, y, z + 0.4); if screen_x then dxDrawFramedText("Tempo de Pagamento: "..payout_otime.." "..payout_unit, screen_x, screen_y, screen_x, screen_y, tocolor(255, 255, 255, 255), 1.0, "default-bold", "center", "center", false, false, false); end screen_x, screen_y = getScreenFromWorldPosition(x, y, z + 0.2); if screen_x then dxDrawFramedText("Banco: $"..bank, screen_x, screen_y, screen_x, screen_y, tocolor(255, 255, 255, 255), 1.0, "default-bold", "center", "center", false, false, false); end end end end end ); addEvent("business.showInstructions", true); addEventHandler("business.showInstructions", root, function() addEventHandler("onClientRender", root, showInstructions); end ); function showInstructions() if settings.key then dxDrawText("Use",(screen_width / 1400) * 550,(screen_height / 900) * 450,(screen_width / 1440) * 100,(screen_height / 900) * 100, tocolor(255, 255, 255, 255),(screen_width / 1440) * 2.0); dxDrawText(settings.key:upper(),(screen_width / 1440) * 615,(screen_height / 900) * 450,(screen_width / 1440) * 100,(screen_height / 900) * 100, tocolor(255, 0, 0, 255),(screen_width / 1440) * 2.0); dxDrawText(" Para abrir o Negocio",(screen_width / 1440) * 630,(screen_height / 900) * 450,(screen_width / 1440) * 100,(screen_height / 900) * 100, tocolor(255, 255, 255, 255),(screen_width / 1440) * 2.0); end end addEvent("business.hideInstructions", true); addEventHandler("business.hideInstructions", root, function() removeEventHandler("onClientRender", root, showInstructions); end ); addEvent("business.showBusinessWindow", true); addEventHandler("business.showBusinessWindow", root, function(b_marker, is_owner, is_admin) local b_data = b_marker:getData("b_data"); local id, name, owner, cost, payout, payout_time, payout_otime, payout_unit, bank, timer = unpack(b_data); local x, y, z = b_marker.position; if #tostring(id) == 1 then id = "0"..tostring(id) end gui.b.window.text = name; gui.b.label.id.text = "ID: #"..id; gui.b.label.name.text = "Nome: "..name; gui.b.label.owner.text = "Dono: "..owner; gui.b.label.cost.text = "Custo: $"..cost; gui.b.label.payout.text = "Pagamento: $"..payout; gui.b.label.payout_time.text = "Tempo de Pagamento: "..payout_otime.." "..payout_unit; gui.b.label.location.text = "Localização: "..getZoneName(x, y, z, false).."("..getZoneName(x, y, z, true)..")"; gui.b.label.bank.text = "Banco: $"..bank; if is_admin and is_owner then gui.b.tab.action.enabled = true; gui.b.button.sell.enabled = true; gui.b.button.deposit.enabled = true; gui.b.button.withdraw.enabled = true; gui.b.button.set_name.enabled = true; gui.b.button.set_owner.enabled = true; gui.b.button.set_cost.enabled = true; gui.b.button.set_bank.enabled = true; gui.b.button.buy.enabled = false; elseif is_admin and not is_owner and owner ~= "For Sale" then gui.b.tab.action.enabled = true; gui.b.button.set_name.enabled = true; gui.b.button.set_owner.enabled = true; gui.b.button.set_cost.enabled = true; gui.b.button.set_bank.enabled = true; gui.b.button.sell.enabled = true; gui.b.button.buy.enabled = false; gui.b.button.deposit.enabled = false; gui.b.button.withdraw.enabled = false; elseif is_admin and not is_owner and owner == "For Sale" then gui.b.tab.action.enabled = true; gui.b.button.set_name.enabled = true; gui.b.button.set_owner.enabled = true; gui.b.button.set_cost.enabled = true; gui.b.button.set_bank.enabled = true; gui.b.button.sell.enabled = false; gui.b.button.buy.enabled = true; gui.b.button.deposit.enabled = false; gui.b.button.withdraw.enabled = false; elseif not is_admin and is_owner then gui.b.tab.action.enabled = true; gui.b.button.set_name.enabled = false; gui.b.button.set_owner.enabled = false; gui.b.button.set_cost.enabled = false; gui.b.button.set_bank.enabled = false; gui.b.button.sell.enabled = true; gui.b.button.deposit.enabled = true; gui.b.button.withdraw.enabled = true; gui.b.button.buy.enabled = false; elseif not is_admin and not is_owner and owner ~= "For Sale" then gui.b.tab.action.enabled = false; gui.b.tab_panel:setSelectedTab(gui.b.tab.info); elseif not is_admin and not is_owner and owner == "For Sale" then gui.b.tab.action.enabled = true; gui.b.button.set_name.enabled = false; gui.b.button.set_owner.enabled = false; gui.b.button.set_cost.enabled = false; gui.b.button.set_bank.enabled = false; gui.b.button.accept.enabled = false; gui.b.button.sell.enabled = false; gui.b.button.deposit.enabled = false; gui.b.button.withdraw.enabled = false; gui.b.button.buy.enabled = true; end gui.b.window.visible = true; showCursor(true); removeEventHandler("onClientRender", root, showInstructions) end ); addEventHandler("onClientResourceStart", resourceRoot, function() triggerServerEvent("business.getSettings", localPlayer); end ); addEvent("business.getSettings", true); addEventHandler("business.getSettings", root, function(_settings) settings = _settings; end ); core.server.lua local _settings = get(""); local settings = {}; for k, v in pairs(_settings) do k = split(k, ".")[2]; settings[k] = v; end if (settings.key:len() < 1 or settings.key:len() > 1) then settings.key = "N"; end if (not settings.blip or tonumber(settings.blip) == nil) then settings.blip = false; end addEventHandler("onResourceStart", resourceRoot, function() if (settings.database == "mysql") then local host, db, username, password, port, socket = unpack(settings.database_data); if not (host and db and username and password) then outputDebugString("Business: Failed to connect to the MySQL server - The data is invalid"); return; end if (tonumber(port)) then port = "port="..port..";"; else port = ""; end if (socket and socket ~= "") then socket = "socket="..socket..";"; else socket = ""; end database = Connection("mysql", "host="..host..";dbname="..db..";"..port..socket, username, password); if (not database) then outputDebugString("Business: Failed to connect to the MySQL server"); return; end else database = Connection("sqlite", "files/business.db"); if (not database) then outputDebugString("Business: Failed to connect to the SQLite file"); return; end end database:exec("CREATE TABLE IF NOT EXISTS business(id INT, name TEXT, owner TEXT, cost INT, pos TEXT, payout INT, payout_time INT, payout_otime INT, payout_unit TEXT, payout_cur_time INT, bank INT)"); database:query(dbCreateBusinessesCallback, "SELECT * FROM business"); end); function dbCreateBusinessesCallback(query_handle) local sql = query_handle:poll(0); if (sql and #sql > 0) then for index, row in ipairs(sql) do local pos = split(row["pos"], ","); local b_marker = Marker(pos[1], pos[2], pos[3], "cylinder", 1.5, settings.marker_color[1], settings.marker_color[2], settings.marker_color[3], settings.marker_color[4]); b_marker.interior = pos[4]; b_marker.dimension = pos[5]; if (settings.blip ~= false) then if (row["owner"] == "For Sale") then local b_blip = Blip.createAttachedTo(b_marker, settings.blip, 2, 255, 0, 0, 255, 0, 100.0); b_blip.interior = pos[4]; b_blip.dimension = pos[5]; else local b_blip = Blip.createAttachedTo(b_marker, settings.blip, 2, 255, 0, 0, 255, 0, 100.0); b_blip.interior = pos[4]; b_blip.dimension = pos[5]; end end addEventHandler("onMarkerHit", b_marker, onBusinessMarkerHit); addEventHandler("onMarkerLeave", b_marker, onBusinessMarkerLeave); local timer = Timer(businessPayout, row["payout_cur_time"] , 1, b_marker); b_marker:setData("b_data", {row["id"], row["name"], row["owner"], row["cost"], row["payout"], row["payout_time"], row["payout_otime"], row["payout_unit"], row["bank"], timer}); end end end addCommandHandler("negocios", function(player) if (ACL.hasObjectPermissionTo(player, "function.banPlayer")) then triggerClientEvent(player, "business.showCreateBusinessWindow", player); else player:outputMessage("Negocios: Voce nao tem acesso a este comando.", 255, 0, 0); end end); function Player:outputMessage(message, r, g, b) if (settings.info_messages_type == "dx") then dxOutputMessage(message, self, r, g, b); else self:outputChat(message, r, g, b, true); end end function outputMessage(message, player, r, g, b) if (settings.info_messages_type == "dx") then dxOutputMessage(message, player, r, g, b); else player:outputChat(message, r, g, b, true); end end function dxOutputMessage(message, player, r, g, b) triggerClientEvent(player, "business.dxOutputMessage", player, message, r, g, b); end addEvent("business.outputMessage", true); addEventHandler("business.outputMessage", root, function(message, r, g, b) source:outputMessage(message, r, g, b); end); addEvent("business.createBusiness", true); addEventHandler("business.createBusiness", root, function(x, y, z, interior, dimension, name, cost, payout, payout_time, payout_unit) database:query(dbCreateBusinessCallback, {client, x, y, z, interior, dimension, name, cost, payout, payout_time, payout_unit}, "SELECT * FROM business"); end); function dbCreateBusinessCallback(query_handle, client, x, y, z, interior, dimension, name, cost, payout, payout_time, payout_unit) local sql = query_handle:poll(0); if (sql) then local id; if (#sql > 0) then id = sql[#sql]["id"] + 1; else id = 1; end local unit; if (payout_unit == "Segundos") then unit = 1000; elseif (payout_unit == "Minutos") then unit = 60000; elseif (payout_unit == "Horas") then unit = 3600000; elseif (payout_unit == "Dias") then unit = 86400000; end x = tonumber(x); y = tonumber(y); z = tonumber(z); interior = tonumber(interior); dimension = tonumber(dimension); cost = tonumber(cost); payout = tonumber(payout); payout_time = tonumber(payout_time); z = z - 1; database:exec("INSERT INTO business(id,name,owner,cost,pos,payout,payout_time,payout_otime,payout_unit,payout_cur_time,bank) VALUES(?,?,?,?,?,?,?,?,?,?,?)", id, name, "For Sale", cost, x..","..y..","..z..","..interior..","..dimension, payout, payout_time * unit, payout_time, payout_unit, payout_time * unit, 0); local b_marker = Marker(x, y, z, "cylinder", 1.5, settings.marker_color[1], settings.marker_color[2], settings.marker_color[3], settings.marker_color[4]); b_marker.interior = interior; b_marker.dimension = dimension; if (settings.blip ~= false) then local b_blip = Blip.createAttachedTo(b_marker, settings.blip, 2, 255, 0, 0, 255, 0, 100.0); b_blip.interior = interior; b_blip.dimension = dimension; end local timer = Timer(businessPayout, payout_time * unit , 1, b_marker); b_marker:setData("b_data", {id, name, "For Sale", cost, payout, payout_time * unit, payout_time, payout_unit, 0, timer}); addEventHandler("onMarkerHit", b_marker, onBusinessMarkerHit); addEventHandler("onMarkerLeave", b_marker, onBusinessMarkerLeave); if (#tostring(id) == 1) then id = "0".. tostring(id) end client:outputMessage("Negocios: Negocio(ID #"..id..") foi criado com sucesso", 0, 255, 0); end end function onBusinessMarkerHit(hElement, mDim) if (hElement:getType() ~= "player") then return; end if (hElement:isInVehicle()) then return; end if (not mDim) then return; end triggerClientEvent(hElement, "business.showInstructions", hElement); end function onBusinessMarkerLeave(hElement, mDim) if (hElement:getType() ~= "player") then return; end if (hElement:isInVehicle()) then return; end if (not mDim) then return; end triggerClientEvent(hElement, "business.hideInstructions", hElement); end function businessPayout(b_marker) local b_data = b_marker:getData("b_data"); local id, name, owner, cost, payout, payout_time, payout_otime, payout_unit, bank, timer = unpack(b_data); if (owner ~= "For Sale") then bank = bank + payout; database:exec("UPDATE business SET bank = ? WHERE id = ?", bank, id); if (settings.inform_player_of_payout) then local account = Account(owner); if (account) then local player = account:getPlayer(); if (player and player.isElement) then player:outputMessage("Negocios: Negocio \" "..name.." \" pagou($"..payout..")", 0, 255, 0); end end end end timer = Timer(businessPayout, payout_time, 1, b_marker); b_marker:setData("b_data", {id, name, owner, cost, payout, payout_time, payout_otime, payout_unit, bank, timer}); end addEventHandler("onResourceStop", resourceRoot, function() for index, b_marker in ipairs(Element.getAllByType("marker", resourceRoot)) do local b_data = b_marker:getData("b_data"); local id, name, owner, cost, payout, payout_time, payout_otime, payout_unit, bank, timer = unpack(b_data); if (timer and timer:isValid()) then local left = timer:getDetails(); if (left >= 50) then database:exec("UPDATE business SET payout_cur_time = ? WHERE id = ?", left, id); else database:exec("UPDATE business SET payout_cur_time = ? WHERE id = ?", payout_time, id); end end end end); function Ped:isInMarker(marker) local colshape = marker.colShape; return self:isWithinColShape(colshape); end addEventHandler("onResourceStart", resourceRoot, function() for index, player in ipairs(Element.getAllByType("player")) do bindKey(player, settings.key, "up", onPlayerAttemptToOpenBusiness); end end); addEventHandler("onPlayerJoin", root,function() bindKey(source, settings.key, "up", onPlayerAttemptToOpenBusiness); end); function onPlayerAttemptToOpenBusiness(player) for index, b_marker in ipairs(Element.getAllByType("marker", resourceRoot)) do if (player:isInMarker(b_marker)) then local b_data = b_marker:getData("b_data"); local id, name, owner, cost, payout, payout_time, payout_otime, payout_unit, bank, timer = unpack(b_data); triggerClientEvent(player, "business.showBusinessWindow", player, b_marker, getAccountName(getPlayerAccount(player)) == owner, ACL.hasObjectPermissionTo(player, "function.banPlayer")); break; end end end function Ped:getMarker() for index, b_marker in ipairs(Element.getAllByType("marker", resourceRoot)) do if (self:isInMarker(b_marker)) then return b_marker; end end end addEvent("business.buy", true); addEventHandler("business.buy", root, function() local account = client.account; if (not account or account:isGuest()) then client:outputMessage("Business: You are not logged in", 255, 0, 0) return; end local b_marker = client:getMarker(); if (not isElement(b_marker)) then return; end local b_data = b_marker:getData("b_data"); local id, name, owner, cost, payout, payout_time, payout_otime, payout_unit, bank, timer = unpack(b_data); if (owner ~= "For Sale") then client:outputMessage("Business: This business is owned", 255, 0, 0); return; end database:query(dbBuyBusinessCallback, {client, b_marker, id, name, owner, cost, payout, payout_time, payout_otime, payout_unit, bank, timer}, "SELECT * FROM business WHERE owner = ?", account.name); end); addEvent("business.sell", true); addEventHandler("business.sell", root, function() local account = client.account; if (not account or account:isGuest()) then return; end local b_marker = client:getMarker(); if (not isElement(b_marker)) then return; end local b_data = b_marker:getData("b_data"); local id, name, owner, cost, payout, payout_time, payout_otime, payout_unit, bank, timer = unpack(b_data); if (owner ~= account.name) then if (ACL.hasObjectPermissionTo(client, "function.banPlayer")) then database:exec("UPDATE business SET owner = ? WHERE id = ?", "For Sale", id); b_marker:setData("b_data", {id, name, "For Sale", cost, payout, payout_time, payout_otime, payout_unit, bank, timer}); client:outputMessage("Negocios: Voce vendeu o Negocio com Sucesso", 0, 255, 0); return; else client:outputMessage("Negocios: Voce nao e proprietario deste Negocio", 255, 0, 0); return; end end database:exec("UPDATE business SET owner = ?, bank = ? WHERE id = ?", "For Sale", 0, id); client:giveMoney(tonumber(("%.f"):format(cost / 2))); client:giveMoney(bank); b_marker:setData("b_data", {id, name, "For Sale", cost, payout, payout_time, payout_otime, payout_unit, 0}); client:outputMessage("Negocios: Voce vendeu o Negocio com Sucesso, todo o dinheiro no banco foi pago para você.", 0, 255, 0); end); addEvent("business.deposit", true); addEventHandler("business.deposit", root, function(amount) local account = client.account; if (not account or account:isGuest()) then return; end local b_marker = client:getMarker(); if (not isElement(b_marker)) then return; end local b_data = b_marker:getData("b_data"); local id, name, owner, cost, payout, payout_time, payout_otime, payout_unit, bank, timer = unpack(b_data); if (not tonumber(amount)) then client:outputMessage("Negocios: Quantidade invalida", 255, 0, 0); return; end if (owner ~= account.name) then client:outputMessage("Negocios: Você não é o proprietário deste Negocio", 255, 0, 0); return; end if (client.money < amount) then client:outputMessage("Negocios: Você não tem dinheiro suficiente", 255, 0, 0); return; end database:exec("UPDATE business SET bank = ? WHERE id = ?", bank + amount, id); client:takeMoney(amount); b_marker:setData("b_data", {id, name, owner, cost, payout, payout_time, payout_otime, payout_unit, bank + amount, timer}); client:outputMessage("Negocios: Você depositou com sucesso $"..amount.." no negócio", 0, 255, 0); end); addEvent("business.withdraw", true); addEventHandler("business.withdraw", root, function(amount) local account = client.account; if (not account or account:isGuest()) then return; end local b_marker = client:getMarker(); if (not isElement(b_marker)) then return; end local b_data = b_marker:getData("b_data"); local id, name, owner, cost, payout, payout_time, payout_otime, payout_unit, bank, timer = unpack(b_data); if (not tonumber(amount)) then client:outputMessage("Negocios: Quantidade Invalida", 255, 0, 0); return; end if (owner ~= account.name) then client:outputMessage("Negocios: Voce nao e o dono do negocio", 255, 0, 0); return; end if (bank < amount) then client:outputMessage("Negocios: Voce nao tem muito no Banco de Negocios", 255, 0, 0); return; end database:exec("UPDATE business SET bank = ? WHERE id = ?", bank - amount, id); client:giveMoney(amount); b_marker:setData("b_data", {id, name, owner, cost, payout, payout_time, payout_otime, payout_unit, bank - amount, timer}); client:outputMessage("Negocios: Voce retirou com sucesso $"..amount.." do Negocio", 0, 255, 0); end); addEvent("business.setName", true); addEventHandler("business.setName", root, function(new_name) if (new_name == "" or #new_name > 30) then client:outputMessage("Negocios: Valor Invalido", 255, 0, 0); return; end if (not ACL.hasObjectPermissionTo(client, "function.banPlayer")) then client:outputMessage("Negocios: Voce nao tem acesso para fazer isso", 255, 0, 0); return; end local b_marker = client:getMarker(); if (not isElement(b_marker)) then return; end local b_data = b_marker:getData("b_data"); local id, name, owner, cost, payout, payout_time, payout_otime, payout_unit, bank, timer = unpack(b_data); database:exec("UPDATE business SET name = ? WHERE id = ?", new_name, id); b_marker:setData("b_data", {id, new_name, owner, cost, payout, payout_time, payout_otime, payout_unit, bank, timer}); client:outputMessage("Negocios: Voce renomeou com sucesso o negocio", 0, 255, 0); end); addEvent("business.setOwner", true); addEventHandler("business.setOwner", root, function(new_owner) if (not ACL.hasObjectPermissionTo(client, "function.banPlayer")) then client:outputMessage("Negocios: Voce nao tem acesso para fazer isso", 255, 0, 0); return; end local b_marker = client:getMarker(); if (not isElement(b_marker)) then return; end local b_data = b_marker:getData("b_data"); local id, name, owner, cost, payout, payout_time, payout_otime, payout_unit, bank, timer = unpack(b_data); database:exec("UPDATE business SET owner = ? WHERE id = ?", new_owner, id); b_marker:setData("b_data", {id, name, new_owner, cost, payout, payout_time, payout_otime, payout_unit, bank, timer}); client:outputMessage("Negocios: Voce mudou com sucesso o proprietario da empresa", 0, 255, 0); end); addEvent("business.setCost", true); addEventHandler("business.setCost", root, function(amount) if (tonumber(amount) == nil) then client:outputMessage("Negocios: Valor Invalido", 255, 0, 0); return; end amount = tonumber(amount); if (not ACL.hasObjectPermissionTo(client, "function.banPlayer")) then client:outputMessage("Negocios: Voce nao tem acesso para fazer isso", 255, 0, 0); return; end local b_marker = client:getMarker(); if (not isElement(b_marker)) then return; end local b_data = b_marker:getData("b_data"); local id, name, owner, cost, payout, payout_time, payout_otime, payout_unit, bank, timer = unpack(b_data); database:exec("UPDATE business SET cost = ? WHERE id = ?", amount, id); b_marker:setData("b_data", {id, name, owner, amount, payout, payout_time, payout_otime, payout_unit, bank, timer}); client:outputMessage("Negocios: Voce mudou com sucesso o custo do negocio", 0, 255, 0); end); addEvent("business.setBank", true); addEventHandler("business.setBank", root, function(amount) if (tonumber(amount) == nil) then client:outputMessage("Negocios: Valor Invalido", 255, 0, 0); return; end amount = tonumber(amount); if (not ACL.hasObjectPermissionTo(client, "function.banPlayer")) then client:outputMessage("Negocios: Voce nao tem acesso para fazer isso", 255, 0, 0); return; end local b_marker = client:getMarker(); if (not isElement(b_marker)) then return; end local b_data = b_marker:getData("b_data"); local id, name, owner, cost, payout, payout_time, payout_otime, payout_unit, bank, timer = unpack(b_data); database:exec("UPDATE business SET bank = ? WHERE id = ?", amount, id); b_marker:setData("b_data", {id, name, owner, cost, payout, payout_time, payout_otime, payout_unit, amount, timer}); client:outputMessage("Negocios: Voce mudou com sucesso a quantidade de banco comercial", 0, 255, 0); end); addEvent("business.destroy", true); addEventHandler("business.destroy", root, function() if (not ACL.hasObjectPermissionTo(client, "function.banPlayer")) then client:outputMessage("Negocios: Voce nao tem acesso para fazer isso", 255, 0, 0); return; end local b_marker = client:getMarker(); if (not isElement(b_marker)) then return; end local b_data = b_marker:getData("b_data"); local id, name, owner, cost, payout, payout_time, payout_otime, payout_unit, bank, timer = unpack(b_data); if (timer and timer:isValid()) then timer:destroy() end database:exec("DELETE FROM business WHERE id = ?", id); b_marker:destroyAttachedBlips(); b_marker:destroy(); client:outputMessage("Negocios: Voce destruiu com sucesso o negocio", 0, 255, 0); triggerClientEvent(client, "business.hideInstructions", client); database:query(dbReOrderBusinessesCallback, "SELECT * FROM business"); end); function dbBuyBusinessCallback(query_handle, source, b_marker, id, name, owner, cost, payout, payout_time, payout_otime, payout_unit, bank, timer) local sql = query_handle:poll(0); if (#sql == settings.owned_businesses) then source:outputMessage("Negocios: Voce ja possui "..#sql.." negocios , que e o valor maximo", 255, 0, 0); return; end local money = source.money; if (money < cost) then source:outputMessage("Negocios: Voce nao tem dinheiro suficiente", 255, 0, 0) return end database:exec("UPDATE business SET owner = ? WHERE id = ?", source.account.name, id); source:takeMoney(cost); source:outputMessage("Negocios: Voce comprou com sucesso neste negocio", 0, 255, 0); b_marker:setData("b_data", {id, name, source.account.name, cost, payout, payout_time, payout_otime, payout_unit, bank, timer}); end function dbReOrderBusinessesCallback(query_handle) local sql = query_handle:poll(0); if (sql and #sql > 0) then for index, row in ipairs(sql) do database:exec("UPDATE business SET id = ? WHERE id = ?", index, row["id"]); end for index, b_marker in ipairs(Element.getAllByType("marker", resourceRoot)) do database:query(dbUpdateBusinessesIDsCallback, {b_marker, index}, "SELECT id FROM business WHERE id = ?", index); end end end function dbUpdateBusinessesIDsCallback(query_handle, b_marker, index) local sql = query_handle:poll(0); local b_data = b_marker:getData("b_data"); local id, name, owner, cost, payout, payout_time, payout_otime, payout_unit, bank, timer = unpack(b_data); b_marker:setData("b_data", {index, name, owner, cost, payout, payout_time, payout_otime, payout_unit, bank, timer}); end function Element:destroyAttachedBlips() if (not self) then return; end for index, element in pairs(self:getAttachedElements()) do if (element and element.isElement) then element:destroy(); end end end addEvent("business.getSettings", true); addEventHandler("business.getSettings", root, function() triggerClientEvent(source, "business.getSettings", source, settings); end); dxoutput.client local _settings = get(""); local settings = {}; for k, v in pairs(_settings) do k = split(k, ".")[2]; settings[k] = v; end if (settings.key:len() < 1 or settings.key:len() > 1) then settings.key = "N"; end if (not settings.blip or tonumber(settings.blip) == nil) then settings.blip = false; end addEventHandler("onResourceStart", resourceRoot, function() if (settings.database == "mysql") then local host, db, username, password, port, socket = unpack(settings.database_data); if not (host and db and username and password) then outputDebugString("Business: Failed to connect to the MySQL server - The data is invalid"); return; end if (tonumber(port)) then port = "port="..port..";"; else port = ""; end if (socket and socket ~= "") then socket = "socket="..socket..";"; else socket = ""; end database = Connection("mysql", "host="..host..";dbname="..db..";"..port..socket, username, password); if (not database) then outputDebugString("Business: Failed to connect to the MySQL server"); return; end else database = Connection("sqlite", "files/business.db"); if (not database) then outputDebugString("Business: Failed to connect to the SQLite file"); return; end end database:exec("CREATE TABLE IF NOT EXISTS business(id INT, name TEXT, owner TEXT, cost INT, pos TEXT, payout INT, payout_time INT, payout_otime INT, payout_unit TEXT, payout_cur_time INT, bank INT)"); database:query(dbCreateBusinessesCallback, "SELECT * FROM business"); end); function dbCreateBusinessesCallback(query_handle) local sql = query_handle:poll(0); if (sql and #sql > 0) then for index, row in ipairs(sql) do local pos = split(row["pos"], ","); local b_marker = Marker(pos[1], pos[2], pos[3], "cylinder", 1.5, settings.marker_color[1], settings.marker_color[2], settings.marker_color[3], settings.marker_color[4]); b_marker.interior = pos[4]; b_marker.dimension = pos[5]; if (settings.blip ~= false) then if (row["owner"] == "For Sale") then local b_blip = Blip.createAttachedTo(b_marker, settings.blip, 2, 255, 0, 0, 255, 0, 100.0); b_blip.interior = pos[4]; b_blip.dimension = pos[5]; else local b_blip = Blip.createAttachedTo(b_marker, settings.blip, 2, 255, 0, 0, 255, 0, 100.0); b_blip.interior = pos[4]; b_blip.dimension = pos[5]; end end addEventHandler("onMarkerHit", b_marker, onBusinessMarkerHit); addEventHandler("onMarkerLeave", b_marker, onBusinessMarkerLeave); local timer = Timer(businessPayout, row["payout_cur_time"] , 1, b_marker); b_marker:setData("b_data", {row["id"], row["name"], row["owner"], row["cost"], row["payout"], row["payout_time"], row["payout_otime"], row["payout_unit"], row["bank"], timer}); end end end addCommandHandler("negocios", function(player) if (ACL.hasObjectPermissionTo(player, "function.banPlayer")) then triggerClientEvent(player, "business.showCreateBusinessWindow", player); else player:outputMessage("Negocios: Voce nao tem acesso a este comando.", 255, 0, 0); end end); function Player:outputMessage(message, r, g, b) if (settings.info_messages_type == "dx") then dxOutputMessage(message, self, r, g, b); else self:outputChat(message, r, g, b, true); end end function outputMessage(message, player, r, g, b) if (settings.info_messages_type == "dx") then dxOutputMessage(message, player, r, g, b); else player:outputChat(message, r, g, b, true); end end function dxOutputMessage(message, player, r, g, b) triggerClientEvent(player, "business.dxOutputMessage", player, message, r, g, b); end addEvent("business.outputMessage", true); addEventHandler("business.outputMessage", root, function(message, r, g, b) source:outputMessage(message, r, g, b); end); addEvent("business.createBusiness", true); addEventHandler("business.createBusiness", root, function(x, y, z, interior, dimension, name, cost, payout, payout_time, payout_unit) database:query(dbCreateBusinessCallback, {client, x, y, z, interior, dimension, name, cost, payout, payout_time, payout_unit}, "SELECT * FROM business"); end); function dbCreateBusinessCallback(query_handle, client, x, y, z, interior, dimension, name, cost, payout, payout_time, payout_unit) local sql = query_handle:poll(0); if (sql) then local id; if (#sql > 0) then id = sql[#sql]["id"] + 1; else id = 1; end local unit; if (payout_unit == "Segundos") then unit = 1000; elseif (payout_unit == "Minutos") then unit = 60000; elseif (payout_unit == "Horas") then unit = 3600000; elseif (payout_unit == "Dias") then unit = 86400000; end x = tonumber(x); y = tonumber(y); z = tonumber(z); interior = tonumber(interior); dimension = tonumber(dimension); cost = tonumber(cost); payout = tonumber(payout); payout_time = tonumber(payout_time); z = z - 1; database:exec("INSERT INTO business(id,name,owner,cost,pos,payout,payout_time,payout_otime,payout_unit,payout_cur_time,bank) VALUES(?,?,?,?,?,?,?,?,?,?,?)", id, name, "For Sale", cost, x..","..y..","..z..","..interior..","..dimension, payout, payout_time * unit, payout_time, payout_unit, payout_time * unit, 0); local b_marker = Marker(x, y, z, "cylinder", 1.5, settings.marker_color[1], settings.marker_color[2], settings.marker_color[3], settings.marker_color[4]); b_marker.interior = interior; b_marker.dimension = dimension; if (settings.blip ~= false) then local b_blip = Blip.createAttachedTo(b_marker, settings.blip, 2, 255, 0, 0, 255, 0, 100.0); b_blip.interior = interior; b_blip.dimension = dimension; end local timer = Timer(businessPayout, payout_time * unit , 1, b_marker); b_marker:setData("b_data", {id, name, "For Sale", cost, payout, payout_time * unit, payout_time, payout_unit, 0, timer}); addEventHandler("onMarkerHit", b_marker, onBusinessMarkerHit); addEventHandler("onMarkerLeave", b_marker, onBusinessMarkerLeave); if (#tostring(id) == 1) then id = "0".. tostring(id) end client:outputMessage("Negocios: Negocio(ID #"..id..") foi criado com sucesso", 0, 255, 0); end end function onBusinessMarkerHit(hElement, mDim) if (hElement:getType() ~= "player") then return; end if (hElement:isInVehicle()) then return; end if (not mDim) then return; end triggerClientEvent(hElement, "business.showInstructions", hElement); end function onBusinessMarkerLeave(hElement, mDim) if (hElement:getType() ~= "player") then return; end if (hElement:isInVehicle()) then return; end if (not mDim) then return; end triggerClientEvent(hElement, "business.hideInstructions", hElement); end function businessPayout(b_marker) local b_data = b_marker:getData("b_data"); local id, name, owner, cost, payout, payout_time, payout_otime, payout_unit, bank, timer = unpack(b_data); if (owner ~= "For Sale") then bank = bank + payout; database:exec("UPDATE business SET bank = ? WHERE id = ?", bank, id); if (settings.inform_player_of_payout) then local account = Account(owner); if (account) then local player = account:getPlayer(); if (player and player.isElement) then player:outputMessage("Negocios: Negocio \" "..name.." \" pagou($"..payout..")", 0, 255, 0); end end end end timer = Timer(businessPayout, payout_time, 1, b_marker); b_marker:setData("b_data", {id, name, owner, cost, payout, payout_time, payout_otime, payout_unit, bank, timer}); end addEventHandler("onResourceStop", resourceRoot, function() for index, b_marker in ipairs(Element.getAllByType("marker", resourceRoot)) do local b_data = b_marker:getData("b_data"); local id, name, owner, cost, payout, payout_time, payout_otime, payout_unit, bank, timer = unpack(b_data); if (timer and timer:isValid()) then local left = timer:getDetails(); if (left >= 50) then database:exec("UPDATE business SET payout_cur_time = ? WHERE id = ?", left, id); else database:exec("UPDATE business SET payout_cur_time = ? WHERE id = ?", payout_time, id); end end end end); function Ped:isInMarker(marker) local colshape = marker.colShape; return self:isWithinColShape(colshape); end addEventHandler("onResourceStart", resourceRoot, function() for index, player in ipairs(Element.getAllByType("player")) do bindKey(player, settings.key, "up", onPlayerAttemptToOpenBusiness); end end); addEventHandler("onPlayerJoin", root,function() bindKey(source, settings.key, "up", onPlayerAttemptToOpenBusiness); end); function onPlayerAttemptToOpenBusiness(player) for index, b_marker in ipairs(Element.getAllByType("marker", resourceRoot)) do if (player:isInMarker(b_marker)) then local b_data = b_marker:getData("b_data"); local id, name, owner, cost, payout, payout_time, payout_otime, payout_unit, bank, timer = unpack(b_data); triggerClientEvent(player, "business.showBusinessWindow", player, b_marker, getAccountName(getPlayerAccount(player)) == owner, ACL.hasObjectPermissionTo(player, "function.banPlayer")); break; end end end function Ped:getMarker() for index, b_marker in ipairs(Element.getAllByType("marker", resourceRoot)) do if (self:isInMarker(b_marker)) then return b_marker; end end end addEvent("business.buy", true); addEventHandler("business.buy", root, function() local account = client.account; if (not account or account:isGuest()) then client:outputMessage("Business: You are not logged in", 255, 0, 0) return; end local b_marker = client:getMarker(); if (not isElement(b_marker)) then return; end local b_data = b_marker:getData("b_data"); local id, name, owner, cost, payout, payout_time, payout_otime, payout_unit, bank, timer = unpack(b_data); if (owner ~= "For Sale") then client:outputMessage("Business: This business is owned", 255, 0, 0); return; end database:query(dbBuyBusinessCallback, {client, b_marker, id, name, owner, cost, payout, payout_time, payout_otime, payout_unit, bank, timer}, "SELECT * FROM business WHERE owner = ?", account.name); end); addEvent("business.sell", true); addEventHandler("business.sell", root, function() local account = client.account; if (not account or account:isGuest()) then return; end local b_marker = client:getMarker(); if (not isElement(b_marker)) then return; end local b_data = b_marker:getData("b_data"); local id, name, owner, cost, payout, payout_time, payout_otime, payout_unit, bank, timer = unpack(b_data); if (owner ~= account.name) then if (ACL.hasObjectPermissionTo(client, "function.banPlayer")) then database:exec("UPDATE business SET owner = ? WHERE id = ?", "For Sale", id); b_marker:setData("b_data", {id, name, "For Sale", cost, payout, payout_time, payout_otime, payout_unit, bank, timer}); client:outputMessage("Negocios: Voce vendeu o Negocio com Sucesso", 0, 255, 0); return; else client:outputMessage("Negocios: Voce nao e proprietario deste Negocio", 255, 0, 0); return; end end database:exec("UPDATE business SET owner = ?, bank = ? WHERE id = ?", "For Sale", 0, id); client:giveMoney(tonumber(("%.f"):format(cost / 2))); client:giveMoney(bank); b_marker:setData("b_data", {id, name, "For Sale", cost, payout, payout_time, payout_otime, payout_unit, 0}); client:outputMessage("Negocios: Voce vendeu o Negocio com Sucesso, todo o dinheiro no banco foi pago para você.", 0, 255, 0); end); addEvent("business.deposit", true); addEventHandler("business.deposit", root, function(amount) local account = client.account; if (not account or account:isGuest()) then return; end local b_marker = client:getMarker(); if (not isElement(b_marker)) then return; end local b_data = b_marker:getData("b_data"); local id, name, owner, cost, payout, payout_time, payout_otime, payout_unit, bank, timer = unpack(b_data); if (not tonumber(amount)) then client:outputMessage("Negocios: Quantidade invalida", 255, 0, 0); return; end if (owner ~= account.name) then client:outputMessage("Negocios: Você não é o proprietário deste Negocio", 255, 0, 0); return; end if (client.money < amount) then client:outputMessage("Negocios: Você não tem dinheiro suficiente", 255, 0, 0); return; end database:exec("UPDATE business SET bank = ? WHERE id = ?", bank + amount, id); client:takeMoney(amount); b_marker:setData("b_data", {id, name, owner, cost, payout, payout_time, payout_otime, payout_unit, bank + amount, timer}); client:outputMessage("Negocios: Você depositou com sucesso $"..amount.." no negócio", 0, 255, 0); end); addEvent("business.withdraw", true); addEventHandler("business.withdraw", root, function(amount) local account = client.account; if (not account or account:isGuest()) then return; end local b_marker = client:getMarker(); if (not isElement(b_marker)) then return; end local b_data = b_marker:getData("b_data"); local id, name, owner, cost, payout, payout_time, payout_otime, payout_unit, bank, timer = unpack(b_data); if (not tonumber(amount)) then client:outputMessage("Negocios: Quantidade Invalida", 255, 0, 0); return; end if (owner ~= account.name) then client:outputMessage("Negocios: Voce nao e o dono do negocio", 255, 0, 0); return; end if (bank < amount) then client:outputMessage("Negocios: Voce nao tem muito no Banco de Negocios", 255, 0, 0); return; end database:exec("UPDATE business SET bank = ? WHERE id = ?", bank - amount, id); client:giveMoney(amount); b_marker:setData("b_data", {id, name, owner, cost, payout, payout_time, payout_otime, payout_unit, bank - amount, timer}); client:outputMessage("Negocios: Voce retirou com sucesso $"..amount.." do Negocio", 0, 255, 0); end); addEvent("business.setName", true); addEventHandler("business.setName", root, function(new_name) if (new_name == "" or #new_name > 30) then client:outputMessage("Negocios: Valor Invalido", 255, 0, 0); return; end if (not ACL.hasObjectPermissionTo(client, "function.banPlayer")) then client:outputMessage("Negocios: Voce nao tem acesso para fazer isso", 255, 0, 0); return; end local b_marker = client:getMarker(); if (not isElement(b_marker)) then return; end local b_data = b_marker:getData("b_data"); local id, name, owner, cost, payout, payout_time, payout_otime, payout_unit, bank, timer = unpack(b_data); database:exec("UPDATE business SET name = ? WHERE id = ?", new_name, id); b_marker:setData("b_data", {id, new_name, owner, cost, payout, payout_time, payout_otime, payout_unit, bank, timer}); client:outputMessage("Negocios: Voce renomeou com sucesso o negocio", 0, 255, 0); end); addEvent("business.setOwner", true); addEventHandler("business.setOwner", root, function(new_owner) if (not ACL.hasObjectPermissionTo(client, "function.banPlayer")) then client:outputMessage("Negocios: Voce nao tem acesso para fazer isso", 255, 0, 0); return; end local b_marker = client:getMarker(); if (not isElement(b_marker)) then return; end local b_data = b_marker:getData("b_data"); local id, name, owner, cost, payout, payout_time, payout_otime, payout_unit, bank, timer = unpack(b_data); database:exec("UPDATE business SET owner = ? WHERE id = ?", new_owner, id); b_marker:setData("b_data", {id, name, new_owner, cost, payout, payout_time, payout_otime, payout_unit, bank, timer}); client:outputMessage("Negocios: Voce mudou com sucesso o proprietario da empresa", 0, 255, 0); end); addEvent("business.setCost", true); addEventHandler("business.setCost", root, function(amount) if (tonumber(amount) == nil) then client:outputMessage("Negocios: Valor Invalido", 255, 0, 0); return; end amount = tonumber(amount); if (not ACL.hasObjectPermissionTo(client, "function.banPlayer")) then client:outputMessage("Negocios: Voce nao tem acesso para fazer isso", 255, 0, 0); return; end local b_marker = client:getMarker(); if (not isElement(b_marker)) then return; end local b_data = b_marker:getData("b_data"); local id, name, owner, cost, payout, payout_time, payout_otime, payout_unit, bank, timer = unpack(b_data); database:exec("UPDATE business SET cost = ? WHERE id = ?", amount, id); b_marker:setData("b_data", {id, name, owner, amount, payout, payout_time, payout_otime, payout_unit, bank, timer}); client:outputMessage("Negocios: Voce mudou com sucesso o custo do negocio", 0, 255, 0); end); addEvent("business.setBank", true); addEventHandler("business.setBank", root, function(amount) if (tonumber(amount) == nil) then client:outputMessage("Negocios: Valor Invalido", 255, 0, 0); return; end amount = tonumber(amount); if (not ACL.hasObjectPermissionTo(client, "function.banPlayer")) then client:outputMessage("Negocios: Voce nao tem acesso para fazer isso", 255, 0, 0); return; end local b_marker = client:getMarker(); if (not isElement(b_marker)) then return; end local b_data = b_marker:getData("b_data"); local id, name, owner, cost, payout, payout_time, payout_otime, payout_unit, bank, timer = unpack(b_data); database:exec("UPDATE business SET bank = ? WHERE id = ?", amount, id); b_marker:setData("b_data", {id, name, owner, cost, payout, payout_time, payout_otime, payout_unit, amount, timer}); client:outputMessage("Negocios: Voce mudou com sucesso a quantidade de banco comercial", 0, 255, 0); end); addEvent("business.destroy", true); addEventHandler("business.destroy", root, function() if (not ACL.hasObjectPermissionTo(client, "function.banPlayer")) then client:outputMessage("Negocios: Voce nao tem acesso para fazer isso", 255, 0, 0); return; end local b_marker = client:getMarker(); if (not isElement(b_marker)) then return; end local b_data = b_marker:getData("b_data"); local id, name, owner, cost, payout, payout_time, payout_otime, payout_unit, bank, timer = unpack(b_data); if (timer and timer:isValid()) then timer:destroy() end database:exec("DELETE FROM business WHERE id = ?", id); b_marker:destroyAttachedBlips(); b_marker:destroy(); client:outputMessage("Negocios: Voce destruiu com sucesso o negocio", 0, 255, 0); triggerClientEvent(client, "business.hideInstructions", client); database:query(dbReOrderBusinessesCallback, "SELECT * FROM business"); end); function dbBuyBusinessCallback(query_handle, source, b_marker, id, name, owner, cost, payout, payout_time, payout_otime, payout_unit, bank, timer) local sql = query_handle:poll(0); if (#sql == settings.owned_businesses) then source:outputMessage("Negocios: Voce ja possui "..#sql.." negocios , que e o valor maximo", 255, 0, 0); return; end local money = source.money; if (money < cost) then source:outputMessage("Negocios: Voce nao tem dinheiro suficiente", 255, 0, 0) return end database:exec("UPDATE business SET owner = ? WHERE id = ?", source.account.name, id); source:takeMoney(cost); source:outputMessage("Negocios: Voce comprou com sucesso neste negocio", 0, 255, 0); b_marker:setData("b_data", {id, name, source.account.name, cost, payout, payout_time, payout_otime, payout_unit, bank, timer}); end function dbReOrderBusinessesCallback(query_handle) local sql = query_handle:poll(0); if (sql and #sql > 0) then for index, row in ipairs(sql) do database:exec("UPDATE business SET id = ? WHERE id = ?", index, row["id"]); end for index, b_marker in ipairs(Element.getAllByType("marker", resourceRoot)) do database:query(dbUpdateBusinessesIDsCallback, {b_marker, index}, "SELECT id FROM business WHERE id = ?", index); end end end function dbUpdateBusinessesIDsCallback(query_handle, b_marker, index) local sql = query_handle:poll(0); local b_data = b_marker:getData("b_data"); local id, name, owner, cost, payout, payout_time, payout_otime, payout_unit, bank, timer = unpack(b_data); b_marker:setData("b_data", {index, name, owner, cost, payout, payout_time, payout_otime, payout_unit, bank, timer}); end function Element:destroyAttachedBlips() if (not self) then return; end for index, element in pairs(self:getAttachedElements()) do if (element and element.isElement) then element:destroy(); end end end addEvent("business.getSettings", true); addEventHandler("business.getSettings", root, function() triggerClientEvent(source, "business.getSettings", source, settings); end); ui.client gui = {}; local screen_width, screen_height = GuiElement.getScreenSize(); addEventHandler("onClientResourceStart", resourceRoot, function() -- Create Business Window gui.cb = {text = {}, edit = {}, button = {}}; local width, height = 511, 530; local x, y = math.floor((screen_width / 2) - (width / 2)), math.floor(screen_height/2 - height/2); gui.cb.window = dxWindow(x, y, width, height, "Criar Négocios - (Traduzido por +YuMi~')"); gui.cb.window.visible = false; gui.cb.text.info = dxText(0, 25, 511, 51, "Colete as coordenadas e insira os dados para criar o negócio", gui.cb.window); gui.cb.text.posx = dxText(10, 75, 101, 20, "Posição X", gui.cb.window); gui.cb.text.posy = dxText(140, 75, 101, 20, "Posição Y", gui.cb.window); gui.cb.text.posz = dxText(270, 75, 101, 20, "Posição Z", gui.cb.window); gui.cb.text.intdim = dxText(400, 75, 101, 20, "Interior,Dimensão", gui.cb.window); gui.cb.text.info:setAlignX("center"); gui.cb.text.info:setAlignY("center"); gui.cb.text.info:setColor(0, 173, 0); gui.cb.text.posx:setAlignX("center"); gui.cb.text.posx:setAlignY("center"); gui.cb.text.posy:setAlignX("center"); gui.cb.text.posy:setAlignY("center"); gui.cb.text.posz:setAlignX("center"); gui.cb.text.posz:setAlignY("center"); gui.cb.text.intdim:setAlignX("center"); gui.cb.text.intdim:setAlignY("center"); gui.cb.edit.intdim = dxEditField(400, 105, 101, 21, "", gui.cb.window); gui.cb.edit.posx = dxEditField(10, 105, 101, 21, "", gui.cb.window); gui.cb.edit.posy = dxEditField(140, 105, 101, 21, "", gui.cb.window); gui.cb.edit.posz = dxEditField(270, 105, 101, 21, "", gui.cb.window); gui.cb.edit.intdim:setReadOnly(true); gui.cb.edit.posx:setReadOnly(true); gui.cb.edit.posy:setReadOnly(true); gui.cb.edit.posz:setReadOnly(true); gui.cb.button.pickup = dxButton(60, 145, 391, 41, "Pegar Cordenadas", gui.cb.window); gui.cb.button.pickup:setColor(125, 0, 0); gui.cb.text.name = dxText(0, 225, 141, 31, "Nome do Négocio:", gui.cb.window); gui.cb.text.cost = dxText(0, 265, 141, 31, "Custo do Négocio:", gui.cb.window); gui.cb.text.payout = dxText(0, 305, 141, 31, "Pagamento do Négocio:", gui.cb.window); gui.cb.text.payout_time = dxText(0, 345, 141, 31, "Tempo de Pagamento:", gui.cb.window); gui.cb.text.name:setAlignX("center"); gui.cb.text.name:setAlignY("center"); gui.cb.text.cost:setAlignX("center"); gui.cb.text.cost:setAlignY("center"); gui.cb.text.payout:setAlignX("center"); gui.cb.text.payout:setAlignY("center"); gui.cb.text.payout_time:setAlignX("center"); gui.cb.text.payout_time:setAlignY("center"); gui.cb.edit.name = dxEditField(160, 225, 281, 31, "", gui.cb.window); gui.cb.edit.cost = dxEditField(160, 265, 281, 31, "", gui.cb.window); gui.cb.edit.payout = dxEditField(160, 305, 281, 31, "", gui.cb.window); gui.cb.edit.payout_time = dxEditField(160, 345, 191, 31, "", gui.cb.window); gui.cb.unit = dxComboBox(360, 345, 141, nil, gui.cb.window); gui.cb.unit:addItem("Segundos"); gui.cb.unit:addItem("Minutos"); gui.cb.unit:addItem("Horas"); gui.cb.unit:addItem("Dias"); gui.cb.unit:setSelected(2); gui.cb.button.clear = dxButton(10, 490, 111, 31, "Limpar", gui.cb.window); gui.cb.button.cancel = dxButton(390, 490, 111, 31, "Cancelar", gui.cb.window); gui.cb.button.create = dxButton(140, 490, 231, 31, "Criar Négocio", gui.cb.window); gui.cb.button.clear:setColor(125, 0, 0); gui.cb.button.cancel:setColor(125, 0, 0); gui.cb.button.create:setColor(125, 0, 0); gui.cb.button.pickup.func = function(state) if (state ~= "up") then return; end local pos = localPlayer.position; local int = localPlayer.interior; local dim = localPlayer.dimension; local x, y, z = string.format("%.2f", pos.x), string.format("%.2f", pos.y), string.format("%.2f", pos.z); gui.cb.edit.posx.text = x; gui.cb.edit.posy.text = y; gui.cb.edit.posz.text = z; gui.cb.edit.intdim.text = int..","..dim; end gui.cb.button.clear.func = function(state) if (state ~= "up") then return; end gui.cb.edit.posx.text = ""; gui.cb.edit.posy.text = ""; gui.cb.edit.posz.text = ""; gui.cb.edit.intdim.text = ""; gui.cb.edit.name.text = ""; gui.cb.edit.cost.text = ""; gui.cb.edit.payout.text = ""; gui.cb.edit.payout_time.text = ""; gui.cb.unit:setSelected(2); end gui.cb.button.cancel.func = function(state) if (state ~= "up") then return; end gui.cb.window.visible = false; showCursor(false); end gui.cb.button.create.func = function(state) if (state ~= "up") then return; end local x, y, z, intdim = gui.cb.edit.posx.text, gui.cb.edit.posy.text, gui.cb.edit.posz.text, gui.cb.edit.intdim.text; local name = gui.cb.edit.name.text; local cost = gui.cb.edit.cost.text; local payout = gui.cb.edit.payout.text; local payout_time = gui.cb.edit.payout_time.text; -- local payout_unit = gui.cb.unit:getItemText(gui.cb.unit:getSelected()); if x ~= "" and name ~= "" and cost ~= "" and tonumber(cost) ~= nil and payout ~= "" and tonumber(payout) ~= nil and payout_time ~= "" and tonumber(payout_time) ~= nil and tonumber(payout_time) > 0 and tonumber(cost) > 0 and tonumber(payout) > 0 then if #name > 30 then outputMessage("BUSINESS: Business name must not be more than 30 characters", 255, 0, 0); return; end local zone = getZoneName(tonumber(x), tonumber(y), tonumber(z), false); if zone == "Unknown" then zone = "the middle of no where" end; local interior = tonumber(gettok(intdim, 1, ",")); local dimension = tonumber(gettok(intdim, 2, ",")); dxPrompt("Tem certeza de que deseja criar o negócio '"..name.."' em "..zone, function() Sound("files/cash.mp3", false); showCursor(false); local x, y, z, intdim = gui.cb.edit.posx.text, gui.cb.edit.posy.text, gui.cb.edit.posz.text, gui.cb.edit.intdim.text; local interior, dimension = unpack(split(intdim, ",")); local name = gui.cb.edit.name.text; local cost = gui.cb.edit.cost.text; local payout = gui.cb.edit.payout.text; local payout_time, payout_unit = gui.cb.edit.payout_time.text, gui.cb.unit:getItemText(gui.cb.unit:getSelected()); triggerServerEvent("business.createBusiness", root, x, y, z, interior, dimension, name, cost, payout, payout_time, payout_unit); gui.cb.button.clear.func("up"); gui.cb.window.visible = false; end); else outputMessage("BUSINESS: The data isn't correct, please correct it", 255, 0, 0); end end -- Business Window gui.b = {label = {}, tab = {}, edit = {}, button = {}}; local width, height = 524, 300; local x = screen_width/2 - width/2; local y = screen_height/2 - height/2; gui.b.window = dxWindow(x, y, width, height, "Business Name", false); gui.b.window.visible = false; gui.b.window:setTitleColor(125, 0, 0); gui.b.tab_panel = dxTabPanel(5, 50, 511, 231, gui.b.window); gui.b.tab.info = dxTab("Informações", gui.b.tab_panel); gui.b.label.id = dxText(10, 20, 81, 16, "ID: #", gui.b.tab.info); gui.b.label.name = dxText(10, 70, 241, 16, "Name:", gui.b.tab.info); gui.b.label.owner = dxText(10, 120, 231, 16, "Owner: ", gui.b.tab.info); gui.b.label.cost = dxText(10, 170, 191, 16, "Cost: ", gui.b.tab.info); gui.b.label.payout = dxText(290, 20, 211, 16, "Payout: ", gui.b.tab.info); gui.b.label.payout_time = dxText(290, 70, 211, 16, "Payout Time:", gui.b.tab.info); gui.b.label.location = dxText(290, 120, 211, 16, "Location:", gui.b.tab.info); gui.b.label.bank = dxText(290, 170, 211, 16, "Bank:", gui.b.tab.info); gui.b.label.id:setAlignX("left", false); gui.b.label.id:setAlignY("center"); gui.b.label.name:setAlignX("left", false); gui.b.label.name:setAlignY("center"); gui.b.label.owner:setAlignX("left", false); gui.b.label.owner:setAlignY("center"); gui.b.label.cost:setAlignX("left", false); gui.b.label.cost:setAlignY("center"); gui.b.label.payout:setAlignX("left", false); gui.b.label.payout:setAlignY("center"); gui.b.label.payout_time:setAlignX("left", false); gui.b.label.payout_time:setAlignY("center"); gui.b.label.location:setAlignX("left", false); gui.b.label.location:setAlignY("center"); gui.b.label.bank:setAlignX("left", false); gui.b.label.bank:setAlignY("center"); gui.b.tab.action = dxTab("Ações", gui.b.tab_panel); gui.b.button.buy = dxButton(10, 10, 101, 31, "Comprar", gui.b.tab.action); gui.b.button.sell = dxButton(10, 60, 101, 31, "Vender", gui.b.tab.action); gui.b.button.deposit = dxButton(10, 110, 101, 31, "Deposito", gui.b.tab.action); gui.b.button.withdraw = dxButton(10, 160, 101, 31, "Retirar", gui.b.tab.action); gui.b.button.set_name = dxButton(390, 10, 101, 31, "Mudar Nome", gui.b.tab.action); gui.b.button.set_owner = dxButton(390, 60, 101, 31, "Mudar Dono", gui.b.tab.action); gui.b.button.set_cost = dxButton(390, 110, 101, 31, "Mudar Custo", gui.b.tab.action); gui.b.button.set_bank = dxButton(390, 160, 101, 31, "Mudar Banco", gui.b.tab.action); gui.b.button.destroy = dxButton(130, 155, 241, 41, "Deletar", gui.b.tab.action); gui.b.button.x = dxButton(480, 25, 31, 31, "X", gui.b.window); gui.b.button.x.func = function(state) if (state ~= "up") then return; end gui.b.window.visible = false; showCursor(false); end gui.b.button.buy.func = function(state) if (state ~= "up") then return; end dxPrompt("Tem certeza de que quer comprar este negócio?", function() triggerServerEvent("business.buy", root); gui.b.window.visible = false; showCursor(false); end); end gui.b.button.sell.func = function(state) if (state ~= "up") then return; end dxPrompt("Tem certeza de que quer vender esse negócio?", function() triggerServerEvent("business.sell", root); gui.b.window.visible = false; showCursor(false); end); end; gui.b.button.deposit.func = function(state) if (state ~= "up") then return; end dxPrompt("Digite o valor a depositar", function(amount) amount = tonumber(amount); if (not amount) then outputMessage("You must enter a correct amount", 255, 0, 0); return; end triggerServerEvent("business.deposit", root, amount); gui.b.window.visible = false; showCursor(false); end, nil, true); end; gui.b.button.withdraw.func = function(state) if (state ~= "up") then return; end dxPrompt("Digite o valor a retirar", function(amount) amount = tonumber(amount); if (not amount) then outputMessage("You must enter a correct amount", 255, 0, 0); return; end triggerServerEvent("business.withdraw", root, amount); gui.b.window.visible = false; showCursor(false); end, nil, true); end; gui.b.button.set_name.func = function(state) if (state ~= "up") then return; end dxPrompt("Digite o novo nome", function(name) if (name == "" or name:len() < 4) then outputMessage("Name must be at least 4 characters long", 255, 0, 0); return; end triggerServerEvent("business.setName", root, name); gui.b.window.visible = false; showCursor(false); end, nil, true); end; gui.b.button.set_owner.func = function(state) if (state ~= "up") then return; end dxPrompt("Digite o nome da conta do novo proprietário", function(owner) if (owner == "") then outputMessage("Owner's account name must be at least 1 character long", 255, 0, 0); return; end triggerServerEvent("business.setOwner", root, owner); gui.b.window.visible = false; showCursor(false); end, nil, true); end; gui.b.button.set_cost.func = function(state) if (state ~= "up") then return; end dxPrompt("Digite o valor para definir o custo", function(amount) amount = tonumber(amount); if (not amount) then outputMessage("You must enter a correct amount", 255, 0, 0); return; end triggerServerEvent("business.setCost", root, amount); gui.b.window.visible = false; showCursor(false); end, nil, true); end; gui.b.button.set_bank.func = function(state) if (state ~= "up") then return; end dxPrompt("Digite o valor para definir o banco", function(amount) amount = tonumber(amount); if (not amount) then outputMessage("You must enter a correct amount", 255, 0, 0); return; end triggerServerEvent("business.setBank", root, amount); gui.b.window.visible = false; showCursor(false); end, nil, true); end; gui.b.button.destroy.func = function(state) if (state ~= "up") then return; end dxPrompt("Tem certeza de que quer destruir o negócio", function() triggerServerEvent("business.destroy", root); gui.b.window.visible = false; showCursor(false); end); end; end);
  2. Pedro001

    Hex Name colors

    OMG! Once again, thank you very much! ^^
  3. Pedro001

    Hex Name colors

    Yes it works!!! The killer's name is a bit far from the icon, but I'll see if I can do it. Thank you very much !!!
  4. Pedro001

    Hex Name colors

    It didn't work 😫
  5. Pedro001

    Hex Name colors

    How can I make this code to show players names in their colors as in their nick? I haven't seen any resource using this type of code to predefine colors. 😫 this is client sided. local screen_maxX, screen_maxY = guiGetScreenSize() local icon1_centerX, icon1_topY = 0.84, 0.3 local icon_width, icon_height = 24, 24 local icon_sideMargin, icon_bottomMargin = 10, 5 local label_width, label_height = 200, 20 local label_font, label_topMargin = "default-bold", 3 local label_shadowColor = tocolor(12,12,12) local rows = 5 local rows_margin = icon_height + icon_bottomMargin local label1_leftX = screen_maxX * icon1_centerX - icon_width/2 - icon_sideMargin - label_width local label1_rightX = label1_leftX + label_width local label2_leftX = label1_rightX + icon_sideMargin*2 + icon_width local label2_rightX = label2_leftX + label_width local icon_leftX = label1_rightX + icon_sideMargin local icon_topY = screen_maxY * icon1_topY local root = getRootElement() local resourceRoot = getResourceRootElement() local killRow = {} local imagePath = { [0] = "icons/weapons/fist.png", [1] = "icons/weapons/brassKnuckles.png", [2] = "icons/weapons/golfClub.png", [3] = "icons/weapons/nightstick.png", [4] = "icons/weapons/knife.png", [5] = "icons/weapons/baseballBat.png", [6] = "icons/weapons/shovel.png", [7] = "icons/weapons/poolCue.png", [8] = "icons/weapons/katana.png", [9] = "icons/weapons/chainsaw.png", [10] = "icons/weapons/dildo.png", [11] = "icons/weapons/dildo.png", [12] = "icons/weapons/dildo.png", [13] = "icons/deathReasons/death.png", [14] = "icons/weapons/flowers.png", [15] = "icons/weapons/cane.png", [16] = "icons/weapons/grenade.png", [17] = "icons/weapons/tearGas.png", [18] = "icons/weapons/molotovCocktail.png", [19] = "icons/weapons/rocketLauncher.png", [20] = "icons/weapons/hsRocketLauncher.png", [21] = "icons/deathReasons/explosion.png", [22] = "icons/weapons/9mm.png", [23] = "icons/weapons/silenced9mm.png", [24] = "icons/weapons/desertEagle.png", [25] = "icons/weapons/shotgun.png", [26] = "icons/weapons/sawnoffShotgun.png", [27] = "icons/weapons/combatShotgun.png", [28] = "icons/weapons/microSmg.png", [29] = "icons/weapons/mp5.png", [30] = "icons/weapons/ak47.png", [31] = "icons/weapons/m4.png", [32] = "icons/weapons/tec9.png", [33] = "icons/weapons/countryRifle.png", [34] = "icons/weapons/sniperRifle.png", [35] = "icons/weapons/rocketLauncher.png", [36] = "icons/weapons/hsRocketLauncher.png", [37] = "icons/weapons/flamethrower.png", [38] = "icons/weapons/minigun.png", [39] = "icons/weapons/satchelCharge.png", [40] = "icons/weapons/detonator.png", [41] = "icons/weapons/spraycan.png", [42] = "icons/weapons/fireExtinguisher.png", [43] = "icons/deathReasons/explosion.png", [44] = "icons/weapons/goggles.png", [45] = "icons/weapons/goggles.png", [46] = "icons/weapons/parachute.png", [49] = "icons/deathReasons/rammed.png", [50] = "icons/deathReasons/helicopterBlades.png", [51] = "icons/deathReasons/explosion.png", [52] = "icons/deathReasons/fire.png", [53] = "icons/deathReasons/death.png", [54] = "icons/deathReasons/fall.png", [255] = "icons/deathReasons/death.png", connected = "icons/connectStates/connected.png", disconnected = "icons/connectStates/disconnected.png" } function onClientResourceStart(resource) setBlurLevel(0) end addEventHandler( "onClientResourceStart", resourceRoot, onClientResourceStart) function renderClientKillPanel () for r = 1, rows do if killRow[r] then dxDrawText( killRow[r]["killerName"], killRow[r]["killerNamePos"]["leftX"] + 1, killRow[r]["killerNamePos"]["topY"] + 1, killRow[r]["killerNamePos"]["rightX"] + 1, killRow[r]["killerNamePos"]["bottomY"] + 1, label_shadowColor, 1, label_font, "right" ) dxDrawText( killRow[r]["killerName"], killRow[r]["killerNamePos"]["leftX"], killRow[r]["killerNamePos"]["topY"], killRow[r]["killerNamePos"]["rightX"], killRow[r]["killerNamePos"]["bottomY"], killRow[r]["killerNameColor"], 1, label_font, "right" ) dxDrawImage( killRow[r]["reasonIconPos"]["leftX"], killRow[r]["reasonIconPos"]["topY"], icon_width, icon_height, imagePath[ killRow[r]["deathReason"] ] ) dxDrawText( killRow[r]["victimName"], killRow[r]["victimNamePos"]["leftX"] + 1, killRow[r]["victimNamePos"]["topY"] + 1, killRow[r]["victimNamePos"]["rightX"] + 1, killRow[r]["victimNamePos"]["bottomY"] + 1, label_shadowColor, 1, label_font ) dxDrawText( killRow[r]["victimName"], killRow[r]["victimNamePos"]["leftX"], killRow[r]["victimNamePos"]["topY"], killRow[r]["victimNamePos"]["rightX"], killRow[r]["victimNamePos"]["bottomY"], killRow[r]["victimNameColor"], 1, label_font ) end end end addEventHandler ( "onClientRender", root, renderClientKillPanel ) function un:O(text) return string.gsub(text, "(#%x%x%x%x%x%x)", function(colorString) return "" end) end function showClientDeathMessage ( killerName, killerNameColor, deathReason, victimName, victimNameColor ) local firstRow = killRow[1] for r = 1, rows - 1 do killRow[r] = killRow[r + 1] end if type(killerNameColor) ~= "table" then killerNameColor = {255,255,255, true} end if type(victimNameColor) ~= "table" then victimNameColor = {255,255,255} end if firstRow then killRow[rows] = firstRow killRow[rows]["killerName"] = un:O(tostring(killerName)) killRow[rows]["killerNameColor"] = tocolor( unpack(killerNameColor) ) killRow[rows]["deathReason"] = deathReason killRow[rows]["victimName"] = un:O(tostring(victimName)) killRow[rows]["victimNameColor"] = tocolor( unpack(victimNameColor) ) else killRow[rows] = { ["killerNamePos"] = { leftX = label1_leftX, rightX = label1_rightX, topY = 0, bottomY = 0 }, ["reasonIconPos"] = { leftX = icon_leftX, topY = 0 }, ["victimNamePos"] = { leftX = label2_leftX, rightX = label2_rightX, topY = 0, bottomY = 0 }, ["killerName"] = un:O(tostring(killerName)), ["killerNameColor"] = tocolor( unpack(killerNameColor) ), ["deathReason"] = deathReason, ["victimName"] = un:O(tostring(victimName)), ["victimNameColor"] = tocolor( unpack(victimNameColor) ) } end if imagePath[ killRow[rows]["deathReason"] ] == nil then killRow[rows]["deathReason"] = 255 end if killRow[rows]["killerName"] == killRow[rows]["victimName"] then killRow[rows]["killerName"] = "" end local y = icon_topY for r = 1, rows do if killRow[r] then killRow[r]["killerNamePos"]["topY"] = y + label_topMargin killRow[r]["killerNamePos"]["bottomY"] = y + label_height killRow[r]["reasonIconPos"]["topY"] = y killRow[r]["victimNamePos"]["topY"] = killRow[r]["killerNamePos"]["topY"] killRow[r]["victimNamePos"]["bottomY"] = killRow[r]["killerNamePos"]["bottomY"] end y = y + rows_margin end end addEvent("showDeathMessage", true ) addEventHandler("showDeathMessage", resourceRoot, showClientDeathMessage ) function killPanelTest() showClientDeathMessage( "oldPlayerName", { math.random(0,255), math.random(0,255), math.random(0,255) }, "disconnected", "", {0,0,0} ) for r = 2, rows - 1 do local c, nameLen, name1, name2 = 1, math.random(4,20), "", "" while c <= nameLen do name1 = name1 .. string.char( math.random(33,125) ) c = c + 1 end c, nameLen = 1, math.random(4,20) while c <= nameLen do name2 = name2 .. string.char( math.random(33,125) ) c = c + 1 end showClientDeathMessage( name1, { math.random(0,255), math.random(0,255), math.random(0,255) }, math.random(0,54), name2, { math.random(0,255), math.random(0,255), math.random(0,255) } ) end showClientDeathMessage( "newPlayerHere", { math.random(0,255), math.random(0,255), math.random(0,255) }, "connected", "", {0,0,0} ) end this is server sided --[[------------------------------------------------- SA-MP Kill Messages для MTA:SA (DX версия) от MX_Master'а * Это серверный скрипт * Кодировка файла - UTF8 * Протестировано на MTA:SA 1.0.4 --]]--------------- -- НАСТРОЙКИ (нельзя изменять) -- local root = getRootElement() local resourceRoot = getResourceRootElement() -- если умер какой-то онлайн игрок addEventHandler( "onPlayerWasted", root, function ( killerWeaponAmmo, killer, deathReason ) -- если жертва это не игрок, то выводить на экран кил сообщение не надо if getElementType(source) ~= "player" then return end local killerName, killerNameColor -- если киллер это не игрок, а например тачка, то if not isElement(killer) or getElementType(killer) ~= "player" then killerName = "" killerNameColor = {0,0,0} -- а если киллер это игрок, то else killerName = getPlayerName(killer) killerNameColor = { getPlayerNametagColor(killer) } end -- если использовалась одна из 2 видов ракет if (deathReason == 19) or (deathReason == 20) or (deathReason == 21) then if getElementType(killer) == "player" then deathReason = getPedWeapon(killer) end end -- добавим в кил панельку каждого игрока новый ряд triggerClientEvent( "showDeathMessage", resourceRoot, killerName, killerNameColor, deathReason, getPlayerName(source), { getPlayerNametagColor(source) } ) end ) -- если какой-то игрок вошел на сервер addEventHandler( "onPlayerJoin", root, function() -- добавим в кил панельку каждого игрока новый ряд triggerClientEvent( "showDeathMessage", resourceRoot, getPlayerName(source), {255,255,255}, "connected", "", {0,0,0} ) end ) -- если какой-то игрок вышел с сервера addEventHandler( "onPlayerQuit", root, function() -- добавим в кил панельку каждого игрока новый ряд triggerClientEvent( "showDeathMessage", resourceRoot, getPlayerName(source), {200,200,200}, "disconnected", "", {0,0,0} ) end )
  6. Pedro001

    Group name over head.

    Hey man, thank you very much for responding me, I apreciate! However... I'm getting Bad argument @ 'getElementData' [Expected element at argument 1, got nil] I did some research but I couldn't find the reason
  7. Pedro001

    Group name over head.

    How can I make a script to put the name of the group the player is in, over his head?
  8. Pedro001

    Wanted Tag!?

    local Timer = {} Bribe = {} xMain_ = function( ) for index,v in ipairs (getElementsByType("player")) do xWanted_(v) end end addEventHandler("onResourceStart", resourceRoot, xMain_); xWanted_ = function(v) if not isElement(v) then return end Timer[v] = setTimer( function(player) if isElement(player) then local team = getPlayerTeam(player) if ( team and getTeamName(team) == "Police" ) then return end local Wanted = getPlayerWantedLevel ( player ); local x,y,z = getElementPosition ( player ); local Name = getPlayerName ( player ); if ( Wanted >= 1 ) then if Bribe[player] and isElement(Bribe[player]) then return end Bribe[player] = createObject(1247,x,y,z); attachElements (Bribe[player],player,0,0,1.6) ; outputChatBox(" [ "..Name.." ] Have [ "..Wanted.." ] Wanted Level! ",v,255,0,0,true); elseif ( Wanted == 0 and Bribe[player] and isElement(Bribe[player]) ) then destroyElement(Bribe[player]); Bribe[player] = nil end end end ,5000,0,v); end xJoin_ = function ( ) xWanted_(source); end addEventHandler("onPlayerJoin",root,xJoin_); xWantedDestroy_ = function ( ) if Timer[source] and isTimer(Timer[source]) then killTimer(Timer[source]); Timer[source] = nil end; if Bribe[source] and isElement(Bribe[source]) then destroyElement(Bribe[source]); Bribe[source] = nil end end addEventHandler("onPlayerQuit",root,xWantedDestroy_); Hii! Please, can someone help me with this? This code creates a start over the head of a player when he's being wanted by the police. But the star causes a bug when the player get into a big vehicle like a bus, so I wanted to change the star into a text, like, instead of showing a start, the code would just write "WANTED" over the player's head, just like a tag. So, could someone tell me how to do it, please?
  9. Pedro001

    Private VIP Panel...2 :p ?

    No, the original code works just fine Hey hey! There was an extra "end" on line 401. I removed it and it is working 😁 Thank you very much!
  10. Pedro001

    Private VIP Panel...2 :p ?

    Hey man, thank you very much for spending your time time doing this for me... But it isn't working... I'm getting the messages that I triggered serverside event shiwwinow, but the event is not added serversie. and I triggered serverside event status, but event is not added serverside.
  11. Pedro001

    Private VIP Panel...2 :p ?

    Yes! That's it! haha, you summarized it pretty good ^^
  12. Pedro001

    Private VIP Panel...2 :p ?

    Yaa! Guys, Nexus posted a decompiled version of his vip panel on the community himself, You can find the link on the comments section of the resource right here. https://community.multitheftauto.com/index.php?p=resources&amp;s=comments&amp;id=11136 thus I'm not stealing anything! But I wanted to ask for help on how to make this panel private, so that the panel will appear only for the ones in the acl group of Console. I've been trying to do it myself for almost a month now, but I just started learning Lua, and this will take so long for me to be able to do it. 😓 I know I shouldn't ask someone to do it for me but, could someone at least give me as much simplified explanation as possible on how I can finally do it? 😞 ClientSide - Decompiled Client.luac Center = function(l_1_0) local l_1_1, l_1_2 = guiGetScreenSize() local l_1_3, l_1_4 = guiGetSize(l_1_0, false) local l_1_5 = (l_1_1 - l_1_3) / 2 local l_1_6 = (l_1_2 - l_1_4) / 2 guiSetPosition(l_1_0, l_1_5, l_1_6, false) end wCenter = function(l_2_0) local l_2_1, l_2_2 = guiGetScreenSize() local l_2_3, l_2_4 = guiGetSize(l_2_0, false) local l_2_5 = (l_2_1 - l_2_3) / 2 local l_2_6 = (l_2_2 - l_2_4) / 2 guiSetPosition(l_2_0, l_2_5 + 300, l_2_6 - 136, false) end tCenter = function(l_3_0) local l_3_1, l_3_2 = guiGetScreenSize() local l_3_3, l_3_4 = guiGetSize(l_3_0, false) local l_3_5 = (l_3_1 - l_3_3) / 2 local l_3_6 = (l_3_2 - l_3_4) / 2 guiSetPosition(l_3_0, l_3_5 + 300, l_3_6 + 5, false) end fsCenter = function(l_4_0) local l_4_1, l_4_2 = guiGetScreenSize() local l_4_3, l_4_4 = guiGetSize(l_4_0, false) local l_4_5 = (l_4_1 - l_4_3) / 2 local l_4_6 = (l_4_2 - l_4_4) / 2 guiSetPosition(l_4_0, l_4_5 + 300, l_4_6 + 115, false) end addEventHandler("onClientResourceStart", resourceRoot, function() wnd = guiCreateWindow(330, 159, 361, 469, "VIP", false) guiWindowSetMovable(wnd, false) guiWindowSetSizable(wnd, false) guiSetVisible(wnd, false) Center(wnd) guiSetProperty(wnd, "CaptionColour", "FFFFFF00") vGrid = guiCreateGridList(10, 240, 182, 219, false, wnd) guiGridListAddColumn(vGrid, "Vehicles list", 0.8) addEventHandler("onClientGUIDoubleClick", vGrid, processDoubleClick, false) populateGridlist() vL1 = guiCreateLabel(11, 204, 345, 15, "_________________________________________________________________________", false, wnd) guiSetFont(vL1, "default-bold-small") guiLabelSetColor(vL1, 0, 0, 0) vIMG = guiCreateStaticImage(11, 28, 167, 116, "VIP.png", false, wnd) vL2 = guiCreateLabel(11, 170, 30, 15, "Name:", false, wnd) guiSetFont(vL2, "default-small") guiLabelSetColor(vL2, 255, 255, 0) vL3 = guiCreateLabel(11, 189, 72, 15, "Subscribe Status:", false, wnd) guiSetFont(vL3, "default-small") guiLabelSetColor(vL3, 255, 255, 0) vL4 = guiCreateLabel(11, 149, 114, 15, "Player Informations", false, wnd) guiSetFont(vL4, "default-small") guiLabelSetColor(vL4, 255, 0, 0) vL5 = guiCreateLabel(11, 223, 49, 17, "Vehicles list", false, wnd) guiSetFont(vL5, "default-small") guiLabelSetColor(vL5, 255, 0, 0) vL6 = guiCreateLabel(312, 449, 39, 15, "by Nexus", false, wnd) guiSetFont(vL6, "default-small") guiLabelSetColor(vL6, 255, 0, 0) vL7 = guiCreateLabel(188, 28, 14, 181, "|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|", false, wnd) guiSetFont(vL7, "default-small") guiLabelSetColor(vL7, 0, 0, 0) vL8 = guiCreateLabel(202, 240, 70, 15, "Vehicle Controls", false, wnd) guiSetFont(vL8, "default-small") guiLabelSetColor(vL8, 255, 0, 0) bCreate = guiCreateButton(202, 265, 70, 20, "Create", false, wnd) guiSetFont(bCreate, "default-bold-small") guiSetProperty(bCreate, "HoverTextColour", "FFFFFF00") guiSetProperty(bCreate, "NormalTextColour", "FFFFFF00") addEventHandler("onClientGUIClick", bCreate, createVehicleHandler, false) bSpawn = guiCreateButton(276, 265, 70, 20, "Spawn", false, wnd) guiSetFont(bSpawn, "default-bold-small") guiSetProperty(bSpawn, "HoverTextColour", "FFFFFF00") guiSetProperty(bSpawn, "NormalTextColour", "FFFFFF00") bWarp = guiCreateButton(202, 289, 70, 20, "Warp", false, wnd) guiSetFont(bWarp, "default-bold-small") guiSetProperty(bWarp, "HoverTextColour", "FFFFFF00") guiSetProperty(bWarp, "NormalTextColour", "FFFFFF00") bDestroy = guiCreateButton(276, 289, 70, 20, "Destroy", false, wnd) guiSetFont(bDestroy, "default-bold-small") guiSetProperty(bDestroy, "HoverTextColour", "FFFFFF00") guiSetProperty(bDestroy, "NormalTextColour", "FFFFFF00") vL9 = guiCreateLabel(202, 353, 145, 15, "_____________________________", false, wnd) guiSetFont(vL9, "default-bold-small") guiLabelSetColor(vL9, 0, 0, 0) bEngine = guiCreateButton(202, 314, 70, 20, "Engine", false, wnd) guiSetFont(bEngine, "default-bold-small") guiSetProperty(bEngine, "HoverTextColour", "FFFFFF00") guiSetProperty(bEngine, "NormalTextColour", "FFFFFF00") bLights = guiCreateButton(276, 314, 70, 20, "Lights", false, wnd) guiSetFont(bLights, "default-bold-small") guiSetProperty(bLights, "HoverTextColour", "FFFFFF00") guiSetProperty(bLights, "NormalTextColour", "FFFFFF00") bLocks = guiCreateButton(202, 338, 144, 20, "Lock / Unlock", false, wnd) guiSetFont(bLocks, "default-bold-small") guiSetProperty(bLocks, "HoverTextColour", "FFFFFF00") guiSetProperty(bLocks, "NormalTextColour", "FFFFFF00") vL10 = guiCreateLabel(202, 373, 39, 15, "Additions", false, wnd) guiSetFont(vL10, "default-small") guiLabelSetColor(vL10, 255, 0, 0) bColors = guiCreateButton(276, 398, 70, 20, "Colors", false, wnd) guiSetFont(bColors, "default-bold-small") guiSetProperty(bColors, "HoverTextColour", "FFFFFF00") guiSetProperty(bColors, "NormalTextColour", "FFFFFF00") bSmoke = guiCreateButton(202, 398, 70, 20, "Smoke", false, wnd) guiSetFont(bSmoke, "default-bold-small") guiSetProperty(bSmoke, "HoverTextColour", "FFFFFF00") guiSetProperty(bSmoke, "NormalTextColour", "FFFFFF00") bArrow = guiCreateButton(202, 424, 70, 20, "Arrow", false, wnd) guiSetFont(bArrow, "default-bold-small") guiSetProperty(bArrow, "HoverTextColour", "FFFFFF00") guiSetProperty(bArrow, "NormalTextColour", "FFFFFF00") bNitrous = guiCreateButton(276, 424, 70, 20, "Nitrous", false, wnd) guiSetFont(bNitrous, "default-bold-small") guiSetProperty(bNitrous, "HoverTextColour", "FFFFFF00") guiSetProperty(bNitrous, "NormalTextColour", "FFFFFF00") bCloseWnd = guiCreateButton(336, 23, 15, 15, "\195\151", false, wnd) guiSetFont(bCloseWnd, "default-bold-small") guiSetProperty(bCloseWnd, "HoverTextColour", "FFFF0000") guiSetProperty(bCloseWnd, "NormalTextColour", "FFFF0000") bSubscribe = guiCreateButton(276, 23, 60, 15, "Subscribe", false, wnd) guiSetFont(bSubscribe, "default-small") guiSetProperty(bSubscribe, "HoverTextColour", "FF00FF00") guiSetProperty(bSubscribe, "NormalTextColour", "FF00FF00") vL11 = guiCreateLabel(202, 48, 65, 15, "Player Controls", false, wnd) guiSetFont(vL11, "default-small") guiLabelSetColor(vL11, 255, 0, 0) bStats = guiCreateButton(202, 73, 144, 20, "VIP Stats", false, wnd) guiSetFont(bStats, "default-bold-small") guiSetProperty(bStats, "HoverTextColour", "FFFFFF00") guiSetProperty(bStats, "NormalTextColour", "FFFFFF00") bFS = guiCreateButton(202, 148, 144, 20, "Fighting Style", false, wnd) guiSetFont(bFS, "default-bold-small") guiSetProperty(bFS, "HoverTextColour", "FFFFFF00") guiSetProperty(bFS, "NormalTextColour", "FFFFFF00") bHealth = guiCreateButton(202, 99, 70, 20, "Health", false, wnd) guiSetFont(bHealth, "default-bold-small") guiSetProperty(bHealth, "HoverTextColour", "FFFFFF00") guiSetProperty(bHealth, "NormalTextColour", "FFFFFF00") bArmor = guiCreateButton(276, 99, 70, 20, "Armor", false, wnd) guiSetFont(bArmor, "default-bold-small") guiSetProperty(bArmor, "HoverTextColour", "FFFFFF00") guiSetProperty(bArmor, "NormalTextColour", "FFFFFF00") bWeather = guiCreateButton(202, 124, 70, 20, "Weather", false, wnd) guiSetFont(bWeather, "default-bold-small") guiSetProperty(bWeather, "HoverTextColour", "FFFFFF00") guiSetProperty(bWeather, "NormalTextColour", "FFFFFF00") bTime = guiCreateButton(276, 124, 70, 20, "Time", false, wnd) guiSetFont(bTime, "default-bold-small") guiSetProperty(bTime, "HoverTextColour", "FFFFFF00") guiSetProperty(bTime, "NormalTextColour", "FFFFFF00") playerN = guiCreateLabel(40, 170, 113, 15, "N/A", false, wnd) guiSetFont(playerN, "default-small") guiLabelSetColor(playerN, 0, 255, 0) playerS = guiCreateLabel(85, 189, 113, 15, "Not Active", false, wnd) guiSetFont(playerS, "default-small") guiLabelSetColor(playerS, 255, 0, 0) wndWeather = guiCreateWindow(695, 159, 234, 197, "Weather", false) guiWindowSetSizable(wndWeather, false) guiSetVisible(wndWeather, false) guiWindowSetMovable(wndWeather, false) wCenter(wndWeather) guiSetProperty(wndWeather, "CaptionColour", "FFFFFF00") wL1 = guiCreateLabel(10, 32, 51, 15, "Set Weather", false, wndWeather) guiSetFont(wL1, "default-small") guiLabelSetColor(wL1, 255, 0, 0) wb1 = guiCreateButton(9, 50, 215, 20, "Blue Skies / Clouds ", false, wndWeather) guiSetFont(wb1, "default-bold-small") guiSetProperty(wb1, "HoverTextColour", "FFFFFF00") guiSetProperty(wb1, "NormalTextColour", "FFFFFF00") wb2 = guiCreateButton(9, 98, 216, 20, "Cloudy and Foggy", false, wndWeather) guiSetFont(wb2, "default-bold-small") guiSetProperty(wb2, "HoverTextColour", "FFFFFF00") guiSetProperty(wb2, "NormalTextColour", "FFFFFF00") wb3 = guiCreateButton(9, 74, 108, 20, "Stormy", false, wndWeather) guiSetFont(wb3, "default-bold-small") guiSetProperty(wb3, "HoverTextColour", "FFFFFF00") guiSetProperty(wb3, "NormalTextColour", "FFFFFF00") wb4 = guiCreateButton(117, 74, 108, 20, "Scorching Hot", false, wndWeather) guiSetFont(wb4, "default-bold-small") guiSetProperty(wb4, "HoverTextColour", "FFFFFF00") guiSetProperty(wb4, "NormalTextColour", "FFFFFF00") wb5 = guiCreateButton(9, 122, 108, 20, "Sandstorm", false, wndWeather) guiSetFont(wb5, "default-bold-small") guiSetProperty(wb5, "HoverTextColour", "FFFFFF00") guiSetProperty(wb5, "NormalTextColour", "FFFFFF00") wb6 = guiCreateButton(117, 122, 108, 20, "Foggy", false, wndWeather) guiSetFont(wb6, "default-bold-small") guiSetProperty(wb6, "HoverTextColour", "FFFFFF00") guiSetProperty(wb6, "NormalTextColour", "FFFFFF00") wb7 = guiCreateButton(9, 146, 216, 20, "Very Dull, Colourless, Hazy ", false, wndWeather) guiSetFont(wb7, "default-bold-small") guiSetProperty(wb7, "HoverTextColour", "FFFFFF00") guiSetProperty(wb7, "NormalTextColour", "FFFFFF00") wb8 = guiCreateButton(9, 170, 216, 20, "Dull, Cloudy, Rainy", false, wndWeather) guiSetFont(wb8, "default-bold-small") guiSetProperty(wb8, "HoverTextColour", "FFFFFF00") guiSetProperty(wb8, "NormalTextColour", "FFFFFF00") wbClose = guiCreateButton(209, 21, 15, 15, "\195\151", false, wndWeather) guiSetFont(wbClose, "default-bold-small") guiSetProperty(wbClose, "HoverTextColour", "FFFF0000") guiSetProperty(wbClose, "NormalTextColour", "FFFF0000") wndTime = guiCreateWindow(695, 361, 234, 81, "Time", false) guiWindowSetSizable(wndTime, false) guiSetVisible(wndTime, false) guiWindowSetMovable(wndTime, false) tCenter(wndTime) guiSetProperty(wndTime, "CaptionColour", "FFFFFF00") tL1 = guiCreateLabel(10, 30, 41, 15, "Set Time", false, wndTime) guiSetFont(tL1, "default-small") guiLabelSetColor(tL1, 255, 0, 0) Hours = guiCreateEdit(41, 49, 30, 22, "12", false, wndTime) guiEditSetMaxLength(Hours, 2) Minutes = guiCreateEdit(114, 49, 30, 22, "00", false, wndTime) guiEditSetMaxLength(Minutes, 2) tL2 = guiCreateLabel(10, 55, 27, 16, "Hours:", false, wndTime) guiSetFont(tL2, "default-small") guiLabelSetColor(tL2, 0, 255, 0) tL3 = guiCreateLabel(76, 55, 34, 16, "Minutes:", false, wndTime) guiSetFont(tL3, "default-small") guiLabelSetColor(tL3, 0, 255, 0) tbSetTime = guiCreateButton(154, 49, 70, 22, "Set", false, wndTime) guiSetFont(tbSetTime, "default-bold-small") guiSetProperty(tbSetTime, "HoverTextColour", "FFFFFF00") guiSetProperty(tbSetTime, "NormalTextColour", "FFFFFF00") tbClose = guiCreateButton(209, 24, 16, 15, "\195\151", false, wndTime) guiSetFont(tbClose, "default-bold-small") guiSetProperty(tbClose, "HoverTextColour", "FFFF0000") guiSetProperty(tbClose, "NormalTextColour", "FFFF0000") wndFStyle = guiCreateWindow(695, 447, 234, 134, "Fighting Style", false) guiWindowSetSizable(wndFStyle, false) guiSetVisible(wndFStyle, false) guiWindowSetMovable(wndFStyle, false) fsCenter(wndFStyle) guiSetProperty(wndFStyle, "CaptionColour", "FFFFFF00") fsL1 = guiCreateLabel(10, 35, 75, 15, "Set Fighting Style", false, wndFStyle) guiSetFont(fsL1, "default-small") guiLabelSetColor(fsL1, 255, 0, 0) fsb1 = guiCreateButton(10, 56, 108, 20, "Standdard", false, wndFStyle) guiSetFont(fsb1, "default-bold-small") guiSetProperty(fsb1, "HoverTextColour", "FFFFFF00") guiSetProperty(fsb1, "NormalTextColour", "FFFFFF00") fsb2 = guiCreateButton(10, 80, 108, 20, "Kung Fu", false, wndFStyle) guiSetFont(fsb2, "default-bold-small") guiSetProperty(fsb2, "HoverTextColour", "FFFFFF00") guiSetProperty(fsb2, "NormalTextColour", "FFFFFF00") fsb3 = guiCreateButton(10, 104, 108, 20, "Grab Kick", false, wndFStyle) guiSetFont(fsb3, "default-bold-small") guiSetProperty(fsb3, "HoverTextColour", "FFFFFF00") guiSetProperty(fsb3, "NormalTextColour", "FFFFFF00") fsb4 = guiCreateButton(117, 56, 108, 20, "Boxing", false, wndFStyle) guiSetFont(fsb4, "default-bold-small") guiSetProperty(fsb4, "HoverTextColour", "FFFFFF00") guiSetProperty(fsb4, "NormalTextColour", "FFFFFF00") fsb5 = guiCreateButton(117, 80, 108, 20, "Knee Head", false, wndFStyle) guiSetFont(fsb5, "default-bold-small") guiSetProperty(fsb5, "HoverTextColour", "FFFFFF00") guiSetProperty(fsb5, "NormalTextColour", "FFFFFF00") fsb6 = guiCreateButton(117, 104, 108, 20, "Elbows", false, wndFStyle) guiSetFont(fsb6, "default-bold-small") guiSetProperty(fsb6, "HoverTextColour", "FFFFFF00") guiSetProperty(fsb6, "NormalTextColour", "FFFFFF00") fsbClose = guiCreateButton(209, 23, 15, 15, "\195\151", false, wndFStyle) guiSetFont(fsbClose, "default-bold-small") guiSetProperty(fsbClose, "HoverTextColour", "FFFF0000") guiSetProperty(fsbClose, "NormalTextColour", "FFFF0000") end ) addEventHandler("onClientGUIClick", root, function() if source == bCloseWnd then guiSetVisible(wnd, false) guiSetVisible(wndWeather, false) guiSetVisible(wndTime, false) guiSetVisible(wndFStyle, false) showCursor(false) elseif source == bSpawn then triggerServerEvent("Spawn", localPlayer) elseif source == bWarp then triggerServerEvent("Warp", localPlayer) elseif source == bDestroy then triggerServerEvent("Destroy", localPlayer) elseif source == bArrow then triggerServerEvent("Arrow", localPlayer) elseif source == bColors then triggerServerEvent("Colors", localPlayer) elseif source == bSmoke then triggerServerEvent("Smoke", localPlayer) elseif source == bEngine then triggerServerEvent("Engine", localPlayer) elseif source == bLights then triggerServerEvent("Lights", localPlayer) elseif source == bLocks then triggerServerEvent("Locks", localPlayer) elseif source == bNitrous then triggerServerEvent("Nitrous", localPlayer) elseif source == bHealth then triggerServerEvent("Health", localPlayer) elseif source == bArmor then triggerServerEvent("Armor", localPlayer) elseif source == bStats then triggerServerEvent("Stats", localPlayer) elseif source == bWeather then local l_6_0 = guiGetVisible(wndWeather) guiSetVisible(wndWeather, not l_6_0) elseif source == bTime then local l_6_1 = guiGetVisible(wndTime) guiSetVisible(wndTime, not l_6_1) elseif source == bFS then local l_6_2 = guiGetVisible(wndFStyle) guiSetVisible(wndFStyle, not l_6_2) elseif source == wb1 then setWeather(math.random(0, 7)) outputChatBox("Weather has been set to Blue Skies / Clouds.", 0, 255, 0) elseif source == wb2 then setWeather(9) outputChatBox("Weather has been set to Cloudy and Foggy.", 0, 255, 0) elseif source == wb3 then setWeather(8) outputChatBox("Weather has been set to Stormy.", 0, 255, 0) elseif source == wb4 then setWeather(math.random(17, 18)) outputChatBox("Weather has been set to Scorching Hot.", 0, 255, 0) elseif source == wb5 then setWeather(19) outputChatBox("Weather has been set to Sandstorm.", 0, 255, 0) elseif source == wb6 then setWeather(20) outputChatBox("Weather has been set to Foggy.", 0, 255, 0) elseif source == wb7 then setWeather(math.random(12, 15)) outputChatBox("Weather has been set to Very Dull, Colourless, Hazy.", 0, 255, 0) elseif source == wb8 then setWeather(16) outputChatBox("Weather has been set to Dull, Cloudy, Rainy.", 0, 255, 0) elseif source == wbClose then guiSetVisible(wndWeather, false) elseif source == tbSetTime then local l_6_3 = guiGetText(Hours) local l_6_4 = guiGetText(Minutes) if l_6_3 and l_6_4 then setTime(l_6_3, l_6_4) outputChatBox("Time changed successfully.", 0, 255, 0) end elseif source == tbClose then guiSetVisible(wndTime, false) elseif source == fsb1 then triggerServerEvent("SetFStyle", localPlayer, 4) outputChatBox("Fighting style has been set to Standard.", 0, 255, 0) elseif source == fsb2 then triggerServerEvent("SetFStyle", localPlayer, 6) outputChatBox("Fighting style has been set to Kung Fu.", 0, 255, 0) elseif source == fsb3 then triggerServerEvent("SetFStyle", localPlayer, 16) outputChatBox("Fighting style has been set to Grab Kick.", 0, 255, 0) elseif source == fsb4 then triggerServerEvent("SetFStyle", localPlayer, 5) outputChatBox("Fighting style has been set to Boxing.", 0, 255, 0) elseif source == fsb5 then triggerServerEvent("SetFStyle", localPlayer, 7) outputChatBox("Fighting style has been set to Knee Head.", 0, 255, 0) elseif source == fsb6 then triggerServerEvent("SetFStyle", localPlayer, 17) outputChatBox("Fighting style has been set to Elbows.", 0, 255, 0) elseif source == fsbClose then guiSetVisible(wndFStyle, false) end end ) createVehicleHandler = function(l_7_0, l_7_1) if l_7_0 == "left" and l_7_1 == "up" then local l_7_2, l_7_3 = guiGridListGetSelectedItem(vGrid) if l_7_2 and l_7_3 and l_7_2 ~= -1 and l_7_3 ~= -1 then local l_7_4 = guiGridListGetItemData(vGrid, l_7_2, l_7_3) l_7_4 = tonumber(l_7_4) local l_7_5 = getLocalPlayer() local l_7_6, l_7_7, l_7_8 = getElementPosition(l_7_5) if l_7_4 and l_7_6 and l_7_7 and l_7_8 then triggerServerEvent("createVehicleFromGUI", l_7_5, l_7_4, l_7_6, l_7_7, l_7_8) else outputChatBox("Invalid arguments.") end else outputChatBox("Please select a vehicle.") end end end populateGridlist = function() local l_8_0 = xmlLoadFile("vehicles.xml") if l_8_0 then xmlUnloadFile(l_8_0) end end populateGridlist = function() local l_9_0 = xmlLoadFile("vehicles.xml") if l_9_0 then for l_9_4,l_9_5 in ipairs(xmlNodeGetChildren(l_9_0)) do local l_9_6 = guiGridListAddRow(vGrid) local l_9_7 = xmlNodeGetAttribute(l_9_5, "type") guiGridListSetItemText(vGrid, l_9_6, 1, l_9_7, true, false) for l_9_11,l_9_12 in ipairs(xmlNodeGetChildren(l_9_5)) do l_9_6 = guiGridListAddRow(vGrid) l_9_7 = xmlNodeGetAttribute(l_9_12, "name") local l_9_13 = xmlNodeGetAttribute(l_9_12, "id") guiGridListSetItemText(vGrid, l_9_6, 1, l_9_7, false, false) guiGridListSetItemText(vGrid, l_9_6, 2, getVehicleType(tonumber(l_9_13)), false, false) guiGridListSetItemData(vGrid, l_9_6, 1, tostring(l_9_13)) end end xmlUnloadFile(l_9_0) end end processDoubleClick = function(l_10_0, l_10_1) if l_10_0 == "left" and l_10_1 == "up" then local l_10_2, l_10_3 = guiGridListGetSelectedItem(vGrid) if l_10_2 and l_10_3 and l_10_2 ~= -1 and l_10_3 ~= -1 and guiGridListGetItemData(vGrid, l_10_2, l_10_3) == "header" then local l_10_4 = guiGridListGetItemText(vGrid, l_10_2, l_10_3) changeGridlistState(l_10_4) end end end changeGridlistState = function(l_11_0) if l_11_0 then if getElementData(vGrid, "expanded") == l_11_0 then guiGridListClear(vGrid) for l_11_4,l_11_5 in pairs(vehicleTable) do local l_11_6 = guiGridListAddRow(vGrid) guiGridListSetItemText(vGrid, l_11_6, 1, l_11_4, false, false) guiGridListSetItemData(vGrid, l_11_6, 1, "header") end setElementData(vGrid, "expanded", "none") else guiGridListClear(vGrid) local l_11_7 = guiGridListAddRow(vGrid) guiGridListSetItemText(vGrid, l_11_7, 1, l_11_0, false, false) guiGridListSetItemData(vGrid, l_11_7, 1, "header") for l_11_11,l_11_12 in ipairs(vehicleTable[l_11_0]) do l_11_7 = guiGridListAddRow(vGrid) guiGridListSetItemText(vGrid, l_11_7, 1, "- " .. l_11_12[2], false, false) guiGridListSetItemData(vGrid, l_11_7, 1, tostring(l_11_12[1])) end setElementData(vGrid, "expanded", l_11_0) end end end populateGridlist = function() local l_12_0 = xmlLoadFile("vehicles.xml") vehicleTable = {} if l_12_0 then for l_12_4,l_12_5 in ipairs(xmlNodeGetChildren(l_12_0)) do local l_12_6 = guiGridListAddRow(vGrid) local l_12_7 = xmlNodeGetAttribute(l_12_5, "type") guiGridListSetItemText(vGrid, l_12_6, 1, l_12_7, false, false) vehicleTable[l_12_7] = {} guiGridListSetItemData(vGrid, l_12_6, 1, "header") for l_12_11,l_12_12 in ipairs(xmlNodeGetChildren(l_12_5)) do local l_12_13 = xmlNodeGetAttribute(l_12_12, "name") local l_12_14 = xmlNodeGetAttribute(l_12_12, "id") table.insert(vehicleTable[l_12_7], {l_12_14, l_12_13}) end end setElementData(vGrid, "expanded", "none") xmlUnloadFile(l_12_0) end end open = function() triggerServerEvent("showwindow", getLocalPlayer()) triggerServerEvent("status", getLocalPlayer()) end bindKey("Z", "down", open) vip = function() if guiGetVisible(wnd) then guiSetVisible(wnd, false) guiSetVisible(wndWeather, false) guiSetVisible(wndTime, false) guiSetVisible(wndFStyle, false) showCursor(false) elseif not getElementData(localPlayer, "isBlocked") == true then guiSetVisible(wnd, true) showCursor(true) end end addEvent("showwindow", true) addEventHandler("showwindow", getRootElement(), vip) vip1 = function() if guiGetVisible(playerS, true) then guiSetText(playerS, "Active") guiLabelSetColor(playerS, 0, 255, 0) if guiGetEnabled(vGrid) == false and guiGetEnabled(bSpawn) == false and guiGetEnabled(bCreate) == false and guiGetEnabled(bWarp) == false and guiGetEnabled(bDestroy) == false and guiGetEnabled(bLights) == false and guiGetEnabled(bLocks) == false and guiGetEnabled(bEngine) == false and guiGetEnabled(bSmoke) == false and guiGetEnabled(bArrow) == false and guiGetEnabled(bColors) == false and guiGetEnabled(bNitrous) == false and guiGetEnabled(bStats) == false and guiGetEnabled(bArmor) == false and guiGetEnabled(bHealth) == false and guiGetEnabled(bWeather) == false and guiGetEnabled(bTime) == false and guiGetEnabled(bFS) == false then guiSetEnabled(bSpawn, true) guiSetEnabled(bCreate, true) guiSetEnabled(bWarp, true) guiSetEnabled(bDestroy, true) guiSetEnabled(bLights, true) guiSetEnabled(bLocks, true) guiSetEnabled(vGrid, true) guiSetEnabled(bEngine, true) guiSetEnabled(bSmoke, true) guiSetEnabled(bColors, true) guiSetEnabled(bNitrous, true) guiSetEnabled(bArrow, true) guiSetEnabled(bStats, true) guiSetEnabled(bHealth, true) guiSetEnabled(bArmor, true) guiSetEnabled(bWeather, true) guiSetEnabled(bTime, true) guiSetEnabled(bFS, true) end end end addEvent("status", true) addEventHandler("status", getRootElement(), vip1) vip2 = function() if guiGetVisible(playerS, true) then guiSetText(playerS, "Not Active") guiLabelSetColor(playerS, 255, 0, 0) if guiGetEnabled(vGrid) == true and guiGetEnabled(bSpawn) == true and guiGetEnabled(bCreate) == true and guiGetEnabled(bWarp) == true and guiGetEnabled(bDestroy) == true and guiGetEnabled(bLights) == true and guiGetEnabled(bLocks) == true and guiGetEnabled(bEngine) == true and guiGetEnabled(bSmoke) == true and guiGetEnabled(bArrow) == true and guiGetEnabled(bColors) == true and guiGetEnabled(bNitrous) == true and guiGetEnabled(bStats) == true and guiGetEnabled(bArmor) == true and guiGetEnabled(bHealth) == true and guiGetEnabled(bWeather) == true and guiGetEnabled(bTime) == true and guiGetEnabled(bFS) == true then guiSetEnabled(bSpawn, false) guiSetEnabled(bCreate, false) guiSetEnabled(bWarp, false) guiSetEnabled(bDestroy, false) guiSetEnabled(bLights, false) guiSetEnabled(bLocks, false) guiSetEnabled(vGrid, false) guiSetEnabled(bEngine, false) guiSetEnabled(bSmoke, false) guiSetEnabled(bColors, false) guiSetEnabled(bNitrous, false) guiSetEnabled(bArrow, false) guiSetEnabled(bStats, false) guiSetEnabled(bHealth, false) guiSetEnabled(bArmor, false) guiSetEnabled(bWeather, false) guiSetEnabled(bTime, false) guiSetEnabled(bFS, false) end end end addEvent("statusF", true) addEventHandler("statusF", getRootElement(), vip2) name = function() if guiGetVisible(playerN, true) then guiSetText(playerN, " " .. getPlayerName(getLocalPlayer()):gsub("#%x%x%x%x%x%x", "")) else guiSetText(playerN, " N/A") end end addEventHandler("onClientRender", getRootElement(), name) ServerSide - Decompiled Server.luac local l_0_0 = {} local l_0_1 = {} local l_0_2 = {} local l_0_3 = {} local l_0_4 = {} local l_0_5 = {} addEventHandler("onPlayerQuit", root, function() if isElement(source) and getElementData(source, "isOwner") ~= nil and getElementType(getElementData(source, "isOwner")) == "vehicle" then destroyElement(getElementData(source, "isOwner")) removeElementData(source, "isOwner") if isTimer(l_0_0[source]) then killTimer(l_0_0[source]) end if isTimer(l_0_1[source]) then killTimer(l_0_1[source]) end if isElement(l_0_4[source]) then destroyElement(l_0_4[source]) l_0_4[source] = nil end if isElement(l_0_5[source]) then destroyElement(l_0_5[source]) l_0_5[source] = nil end end end ) createMyVehicle = function(l_2_0, l_2_1, l_2_2, l_2_3) if l_2_0 and l_2_1 and l_2_2 and l_2_3 and not isGuestAccount(getPlayerAccount(source)) and getElementData(source, "isOwner") == nil then local l_2_4 = getPlayerAccount(source) local l_2_5 = getAccountName(l_2_4) local l_2_6 = getPlayerName(source) local l_2_7 = l_2_6:gsub("#%x%x%x%x%x%x", "") theVehicle = createVehicle(l_2_0, l_2_1 + 2, l_2_2 + 2, l_2_3) setVehicleDamageProof(theVehicle, true) setElementData(source, "isOwner", theVehicle) setElementData(theVehicle, "Owner", l_2_5) setElementData(theVehicle, "OwnerName", l_2_7) setElementData(theVehicle, "Locked", true) return end if l_2_0 and l_2_1 and l_2_2 and l_2_3 then local l_2_8 = getPedOccupiedVehicle(source) local l_2_9 = getElementData(source, "isOwner") if isPedInVehicle(source) and isElement(l_2_8) and isElement(l_2_9) and l_2_8 == l_2_9 then setElementModel(l_2_9, l_2_0) return end end if l_2_0 and l_2_1 and l_2_2 and l_2_3 and not isGuestAccount(getPlayerAccount(source)) and getElementData(source, "isOwner") ~= nil then local l_2_10 = getPlayerAccount(source) local l_2_11 = getAccountName(l_2_10) local l_2_12 = getPlayerName(source):gsub("#%x%x%x%x%x%x", "") if isElement(getElementData(source, "isOwner")) then destroyElement(getElementData(source, "isOwner")) end removeElementData(source, "isOwner") theVehicle = createVehicle(l_2_0, l_2_1 + 2, l_2_2 + 2, l_2_3) setVehicleDamageProof(theVehicle, true) setElementData(source, "isOwner", theVehicle, true) setElementData(theVehicle, "Owner", l_2_11) setElementData(theVehicle, "OwnerName", l_2_12) setElementData(theVehicle, "Locked", true) end end addEvent("createVehicleFromGUI", true) addEventHandler("createVehicleFromGUI", root, createMyVehicle) addEventHandler("onVehicleStartEnter", root, function(l_3_0) local l_3_1 = getElementData(source, "Owner") local l_3_2 = getElementData(source, "Locked") if l_3_1 and l_3_2 then local l_3_3 = getPlayerAccount(l_3_0) if getAccountName(l_3_3) ~= getElementData(source, "Owner") then cancelEvent() b = math.random(0, 255) g = math.random(0, 255) r = math.random(0, 255) outputChatBox(" *[ Private car owned by " .. getElementData(source, "OwnerName") .. " ]", l_3_0, r, g, b, true) else b = math.random(0, 255) g = math.random(0, 255) r = math.random(0, 255) outputChatBox(" *[ Welcome \226\152\186 ]", l_3_0, r, b, g, true) end end end ) addEvent("Spawn", true) addEventHandler("Spawn", root, function() local l_4_0, l_4_1, l_4_2 = getElementPosition(source) local l_4_3 = getElementData(source, "isOwner") if not isElement(l_4_3) then outputChatBox(" *You do not have a car!", source, 255, 0, 0) return end if l_4_3 and isElement(l_4_3) then setElementPosition(getElementData(source, "isOwner"), l_4_0 + 2, l_4_1, l_4_2 + 1) outputChatBox(" *Car Spawned.", source, 255, 0, 0) end end ) addEvent("Warp", true) addEventHandler("Warp", root, function() local l_5_0 = getElementData(source, "isOwner") if not isElement(l_5_0) then outputChatBox(" *You do not have a car!", source, 255, 0, 0) return end if l_5_0 and isElement(l_5_0) then fadeCamera(source, false, 0.5) setTimer(fadeCamera, 500, 1, source, true) warpPedIntoVehicle(source, l_5_0) end end ) addEvent("Destroy", true) addEventHandler("Destroy", root, function() local l_6_0 = getElementData(source, "isOwner") if not isElement(l_6_0) then outputChatBox(" *You do not have a car!", source, 255, 0, 0) return end if l_6_0 and isElement(l_6_0) then destroyElement(l_6_0) outputChatBox(" *Car Destroyed.", source, 255, 0, 0) removeElementData(source, "isOwner") if isElement(l_0_5[source]) then destroyElement(l_0_5[source]) l_0_5[source] = nil end if isElement(l_0_4[source]) then destroyElement(l_0_4[source]) l_0_4[source] = nil end end end ) addEvent("Locks", true) addEventHandler("Locks", root, function() local l_7_0 = getElementData(source, "isOwner") if not isElement(l_7_0) then outputChatBox(" *You do not have a car!", source, 255, 0, 0) return end if l_7_0 and isElement(l_7_0) then local l_7_1 = getElementData(l_7_0, "Locked") if l_7_1 == true then removeElementData(l_7_0, "Locked") outputChatBox(" *Car unlocked.", source, 255, 0, 0) else setElementData(l_7_0, "Locked", true) outputChatBox(" *Car locked.", source, 0, 255, 0) end end end ) addEvent("Engine", true) addEventHandler("Engine", root, function() local l_8_0 = getElementData(source, "isOwner") if not isElement(l_8_0) then outputChatBox(" *You do not have a car!", source, 255, 0, 0) return end if l_8_0 and isElement(l_8_0) then local l_8_1 = getVehicleEngineState(l_8_0) if not l_8_1 then setVehicleEngineState(l_8_0, not l_8_1) outputChatBox(" *Engine started.", source, 0, 255, 0) else setVehicleEngineState(l_8_0, not l_8_1) outputChatBox(" *Engine stopped.", source, 255, 0, 0) end end end ) addEvent("Lights", true) addEventHandler("Lights", root, function() local l_9_0 = getElementData(source, "isOwner") if not isElement(l_9_0) then outputChatBox(" *You do not have a car!", source, 255, 0, 0) return end if l_9_0 and isElement(l_9_0) then local l_9_1 = getVehicleOverrideLights(l_9_0) == 2 if not l_9_1 then setVehicleOverrideLights(l_9_0, 2) outputChatBox(" *Lights On.", source, 0, 255, 0) else setVehicleOverrideLights(l_9_0, 1) outputChatBox(" *Lights Off.", source, 255, 0, 0) end end end ) addEvent("Nitrous", true) addEventHandler("Nitrous", root, function() local l_10_0 = getElementData(source, "isOwner") if not isElement(l_10_0) then outputChatBox(" *You do not have a car!", source, 255, 0, 0) return end if l_10_0 and isElement(l_10_0) then addVehicleUpgrade(l_10_0, 1010) outputChatBox(" *Nitrous upgrade has been added to your vehicle.", source, 0, 255, 0) end end ) addEvent("Arrow", true) addEventHandler("Arrow", root, function() local l_11_0 = getElementData(source, "isOwner") if not isElement(l_11_0) then outputChatBox(" *You do not have a car!", source, 255, 0, 0) return end if l_11_0 and isElement(l_11_0) then if isElement(l_0_5[source]) then destroyElement(l_0_5[source]) outputChatBox(" *The arrow has been removed from your vehicle.", source, 255, 0, 0) else local l_11_1, l_11_2, l_11_3 = getElementPosition(l_11_0) l_0_5[source] = createObject(1318, l_11_1, l_11_2, l_11_3 + 2, 0, 0, 0) attachElements(l_0_5[source], l_11_0, 0, 0, 2) outputChatBox(" *The arrow has been attached to your vehicle.", source, 0, 255, 0) end end end ) addEvent("Colors", true) addEventHandler("Colors", root, function() local l_12_0 = getElementData(source, "isOwner") if not isElement(l_12_0) then outputChatBox(" *You do not have a car!", source, 255, 0, 0) return end if l_12_0 and isElement(l_12_0) then if not l_0_2[source] then l_0_2[source] = true l_0_0[source] = setTimer(randomVehColors, 1000, 0, l_12_0, source) outputChatBox(" *Random colors is now enabled.", source, 0, 255, 0) else l_0_2[source] = false if isTimer(l_0_0[source]) then killTimer(l_0_0[source]) outputChatBox(" *Random colors is now disabled", source, 255, 0, 0) end end end end ) randomVehColors = function(l_13_0, l_13_1) if not isElement(l_13_0) and isElement(l_13_1) then if isTimer(l_0_0[l_13_1]) then killTimer(l_0_0[l_13_1]) end l_0_2[l_13_1] = false return end if isElement(l_13_0) then local l_13_2 = math.random(0, 255) local l_13_3 = math.random(0, 255) local l_13_4 = math.random(0, 255) local l_13_5 = math.random(0, 255) setVehicleColor(l_13_0, l_13_2, l_13_3, l_13_4, l_13_5) end end addEvent("Smoke", true) addEventHandler("Smoke", root, function() local l_14_0 = getElementData(source, "isOwner") if not isElement(l_14_0) then outputChatBox(" *You do not have a car!", source, 255, 0, 0) return end if l_14_0 and isElement(l_14_0) and l_0_3[source] then l_0_3[source] = false if isTimer(l_0_1[source]) then killTimer(l_0_1[source]) end if isElement(l_0_4[source]) then destroyElement(l_0_4[source]) l_0_4[source] = nil end outputChatBox(" *Smoke is now disabled.", source, 255, 0, 0) return end if l_14_0 and isElement(l_14_0) and not l_0_3[source] then l_0_3[source] = true l_0_1[source] = setTimer(addSmoke, 1000, 0, l_14_0, source) outputChatBox(" *Smoke is now enabled.", source, 0, 255, 0) end end ) addSmoke = function(l_15_0, l_15_1) if not isElement(l_15_0) and isElement(l_15_1) then if isTimer(l_0_1[l_15_1]) then killTimer(l_0_1[l_15_1]) end if isElement(l_0_4[l_15_1]) then destroyElement(l_0_4[l_15_1]) l_0_4[l_15_1] = nil end l_0_3[l_15_1] = false return end local l_15_2 = getElementSpeed(l_15_0, "kmh") if l_15_2 >= 120 then local l_15_3, l_15_4, l_15_5 = getElementPosition(l_15_0) if isElement(l_0_4[l_15_1]) then return end l_0_4[l_15_1] = createObject(2780, l_15_3, l_15_4, l_15_5 - 2, 0, 0, 0) setElementAlpha(l_0_4[l_15_1], 0) attachElements(l_0_4[l_15_1], l_15_0, 0, -2, -1) elseif isElement(l_0_4[l_15_1]) then destroyElement(l_0_4[l_15_1]) l_0_4[l_15_1] = nil end end addEvent("Armor", true) addEventHandler("Armor", root, function() if isElement(source) then setPedArmor(source, 100) outputChatBox("Your armor has been set to 100%.", source, 0, 255, 0) end end ) addEvent("Health", true) addEventHandler("Health", root, function() if isElement(source) then setElementHealth(source, 200) outputChatBox("Your health has been set to 100%.", source, 0, 255, 0) end end ) addEvent("SetFStyle", true) addEventHandler("SetFStyle", root, function(l_18_0) if isElement(source) and tonumber(l_18_0) then setPedFightingStyle(source, tonumber(l_18_0)) end end ) addEvent("Stats", true) addEventHandler("Stats", root, function() if isElement(source) then setPedStat(source, 23, 1000) setPedStat(source, 24, 1000) setPedStat(source, 69, 1000) setPedStat(source, 70, 1000) setPedStat(source, 71, 1000) setPedStat(source, 72, 1000) setPedStat(source, 73, 1000) setPedStat(source, 74, 1000) setPedStat(source, 75, 1000) setPedStat(source, 76, 1000) setPedStat(source, 77, 1000) setPedStat(source, 78, 1000) setPedStat(source, 79, 1000) outputChatBox("Your weapon skills and max health has been set to maximum.", source, 0, 255, 0) end end ) getElementSpeed = function(l_20_0, l_20_1) if l_20_1 == nil then l_20_1 = 0 end if isElement(l_20_0) then local l_20_2, l_20_3, l_20_4 = getElementVelocity(l_20_0) if l_20_1 == "mph" or l_20_1 == 1 or l_20_1 == "1" then return l_20_2 ^ 2 + l_20_3 ^ 2 + l_20_4 ^ 2 ^ 0.5 * 100 else return l_20_2 ^ 2 + l_20_3 ^ 2 + l_20_4 ^ 2 ^ 0.5 * 1.61 * 100 end else outputDebugString("Not an element. Can't get speed") return false end end addEvent("status", true) addEventHandler("status", root, function() local l_21_0 = getPlayerAccount(source) local l_21_1 = getAccountName(l_21_0) if isObjectInACLGroup("user." .. l_21_1, aclGetGroup("VIP")) then triggerClientEvent(source, "status", source) else triggerClientEvent(source, "statusF", source) end end ) open = function() triggerClientEvent(source, "showwindow", source) end addEvent("showwindow", true) addEventHandler("showwindow", getRootElement(), open)
  13. Pedro001

    Gang System...

    Is there any gang system on the community that creates an acl group? Cuz I want to use a gang panel but all of them needs to specify an acl group, but none of the resources I found creates an acl group! help please!
  14. Pedro001

    BindKey

    Hey guys... ^^ How can I make a bindKey that will open a GUI only for the players that is in acl Console? .-. Thank you! :3
  15. Pedro001

    Private VIP Panel?

    🤔 That will be harder than I thought.