Jump to content

Duff1995

Members
  • Posts

    31
  • Joined

  • Last visited

Recent Profile Visitors

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

Duff1995's Achievements

Rat

Rat (9/54)

0

Reputation

  1. client side: function onClientResourceStart() addEvent("painel", true) addEventHandler("painel", resourceRoot, abrir) addEvent("pagina2", true) addEventHandler("pagina2", resourceRoot, abrir2) addEvent("pagina3", true) addEventHandler("pagina3", resourceRoot, abrir3) end addEventHandler("onClientResourceStart", resourceRoot, onClientResourceStart) local screenW, screenH = guiGetScreenSize() local x, y = (screenW/1600), (screenH/900) painel = false function abrir () dxDrawRectangle(screenW * 0.3937, screenH * 0.3289, screenW * 0.1975, screenH * 0.4822, tocolor(127, 127, 127, 255), false) dxDrawRectangle(screenW * 0.3937, screenH * 0.3000, screenW * 0.1975, screenH * 0.0289, tocolor(6, 51, 247, 255), false) dxDrawImage(screenW * 0.4113, screenH * 0.2722, screenW * 0.1569, screenH * 0.4333, ":skinshop/skin1.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawRectangle(screenW * 0.4519, screenH * 0.7167, screenW * 0.0719, screenH * 0.0411, tocolor(6, 51, 247, 255), false)--comprar dxDrawRectangle(screenW * 0.4156, screenH * 0.7178, screenW * 0.0269, screenH * 0.0467, tocolor(255, 0, 0, 0), false)--< dxDrawRectangle(screenW * 0.5325, screenH * 0.7133, screenW * 0.0269, screenH * 0.0467, tocolor(255, 0, 0, 0), false)--> dxDrawText("Comprar", screenW * 0.4519, screenH * 0.7167, screenW * 0.5238, screenH * 0.7578, tocolor(255, 255, 255, 255), 1.30, "default", "center", "center", false, false, false, false, false) dxDrawImage(screenW * 0.5331, screenH * 0.7100, screenW * 0.0244, screenH * 0.0533, ":vpanel/fotos/seta1.png", 90, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawImage(screenW * 0.4175, screenH * 0.7100, screenW * 0.0250, screenH * 0.0533, ":vpanel/fotos/seta1.png", 273, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawText("Valor: R$ 500", screenW * 0.4519, screenH * 0.7633, screenW * 0.5238, screenH * 0.7944, tocolor(255, 255, 255, 255), 1.40, "default", "left", "center", false, false, false, false, false) dxDrawText("Precione \"BackSpace\" para fechar!", screenW * 0.3937, screenH * 0.8156, screenW * 0.5913, screenH * 0.8478, tocolor(255, 255, 255, 255), 1.40, "default", "center", "center", false, false, false, false, false) dxDrawText("Skin Shop ", screenW * 0.3937, screenH * 0.3000, screenW * 0.5913, screenH * 0.3289, tocolor(255, 255, 255, 255), 1.40, "default", "center", "center", false, false, false, false, false) dxDrawImage(screenW * 0.5188, screenH * 0.3178, screenW * 0.0825, screenH * 0.1511, ":hud/html/img/logo.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) end pagina2 = false function abrir2 () dxDrawRectangle(screenW * 0.3937, screenH * 0.3289, screenW * 0.1975, screenH * 0.4822, tocolor(127, 127, 127, 255), false) dxDrawRectangle(screenW * 0.3937, screenH * 0.3000, screenW * 0.1975, screenH * 0.0289, tocolor(6, 51, 247, 255), false) dxDrawImage(screenW * 0.4113, screenH * 0.2722, screenW * 0.1569, screenH * 0.4333, ":skinshop/skin2.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawRectangle(screenW * 0.4519, screenH * 0.7167, screenW * 0.0719, screenH * 0.0411, tocolor(6, 51, 247, 255), false)--comprar dxDrawRectangle(screenW * 0.4156, screenH * 0.7178, screenW * 0.0269, screenH * 0.0467, tocolor(255, 0, 0, 0), false)--< dxDrawRectangle(screenW * 0.5325, screenH * 0.7133, screenW * 0.0269, screenH * 0.0467, tocolor(255, 0, 0, 0), false)--> dxDrawText("Comprar", screenW * 0.4519, screenH * 0.7167, screenW * 0.5238, screenH * 0.7578, tocolor(255, 255, 255, 255), 1.30, "default", "center", "center", false, false, false, false, false) dxDrawImage(screenW * 0.5331, screenH * 0.7100, screenW * 0.0244, screenH * 0.0533, ":vpanel/fotos/seta1.png", 90, 0, 0, tocolor(255, 255, 255, 255), false)--> dxDrawImage(screenW * 0.4175, screenH * 0.7100, screenW * 0.0250, screenH * 0.0533, ":vpanel/fotos/seta1.png", 273, 0, 0, tocolor(255, 255, 255, 255), false)--< dxDrawText("Valor: R$ 500", screenW * 0.4519, screenH * 0.7633, screenW * 0.5238, screenH * 0.7944, tocolor(255, 255, 255, 255), 1.40, "default", "left", "center", false, false, false, false, false) dxDrawText("Precione \"BackSpace\" para fechar!", screenW * 0.3937, screenH * 0.8156, screenW * 0.5913, screenH * 0.8478, tocolor(255, 255, 255, 255), 1.40, "default", "center", "center", false, false, false, false, false) dxDrawText("Skin Shop ", screenW * 0.3937, screenH * 0.3000, screenW * 0.5913, screenH * 0.3289, tocolor(255, 255, 255, 255), 1.40, "default", "center", "center", false, false, false, false, false) dxDrawImage(screenW * 0.5188, screenH * 0.3178, screenW * 0.0825, screenH * 0.1511, ":hud/html/img/logo.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) end pagina3 = false function abrir3 () dxDrawRectangle(screenW * 0.3937, screenH * 0.3289, screenW * 0.1975, screenH * 0.4822, tocolor(127, 127, 127, 255), false) dxDrawRectangle(screenW * 0.3937, screenH * 0.3000, screenW * 0.1975, screenH * 0.0289, tocolor(6, 51, 247, 255), false) dxDrawImage(screenW * 0.4113, screenH * 0.2722, screenW * 0.1569, screenH * 0.4333, ":skinshop/skin3.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawRectangle(screenW * 0.4519, screenH * 0.7167, screenW * 0.0719, screenH * 0.0411, tocolor(6, 51, 247, 255), false)--comprar dxDrawRectangle(screenW * 0.4156, screenH * 0.7178, screenW * 0.0269, screenH * 0.0467, tocolor(255, 0, 0, 0), false)--< dxDrawRectangle(screenW * 0.5325, screenH * 0.7133, screenW * 0.0269, screenH * 0.0467, tocolor(255, 0, 0, 0), false)--> dxDrawText("Comprar", screenW * 0.4519, screenH * 0.7167, screenW * 0.5238, screenH * 0.7578, tocolor(255, 255, 255, 255), 1.30, "default", "center", "center", false, false, false, false, false) dxDrawImage(screenW * 0.5331, screenH * 0.7100, screenW * 0.0244, screenH * 0.0533, ":vpanel/fotos/seta1.png", 90, 0, 0, tocolor(255, 255, 255, 255), false)--> dxDrawImage(screenW * 0.4175, screenH * 0.7100, screenW * 0.0250, screenH * 0.0533, ":vpanel/fotos/seta1.png", 273, 0, 0, tocolor(255, 255, 255, 255), false)--< dxDrawText("Valor: R$ 500", screenW * 0.4519, screenH * 0.7633, screenW * 0.5238, screenH * 0.7944, tocolor(255, 255, 255, 255), 1.40, "default", "left", "center", false, false, false, false, false) dxDrawText("Precione \"BackSpace\" para fechar!", screenW * 0.3937, screenH * 0.8156, screenW * 0.5913, screenH * 0.8478, tocolor(255, 255, 255, 255), 1.40, "default", "center", "center", false, false, false, false, false) dxDrawText("Skin Shop ", screenW * 0.3937, screenH * 0.3000, screenW * 0.5913, screenH * 0.3289, tocolor(255, 255, 255, 255), 1.40, "default", "center", "center", false, false, false, false, false) dxDrawImage(screenW * 0.5188, screenH * 0.3178, screenW * 0.0825, screenH * 0.1511, ":hud/html/img/logo.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) end function abrirbind() if painel == false then showCursor (true) addEventHandler ("onClientRender", root,abrir) painel = true else if painel == true then showCursor(false) removeEventHandler("onClientRender",root,abrir) painel = false end end end addEvent("lojaskinstt", true) addEventHandler("lojaskinstt", getRootElement(), abrirbind) function isCursorOnElement(x,y,w,h) local mx,my = getCursorPosition () local fullx,fully = guiGetScreenSize() cursorx,cursory = mx*fullx,my*fully if cursorx > x and cursorx < x + w and cursory > y and cursory < y + h then return true else return false end end function fecharPainel(key) if painel and key == "backspace" then showCursor(false) removeEventHandler("onClientRender", root, abrir) painel = false showCursor(false) end end addEventHandler("onClientKey", root, fecharPainel) ---------------------------------------------------- CORPO function skinpagina1 (_,state) if painel == true then if state == "down" then if isCursorOnElement(screenW * 0.4519, screenH * 0.7167, screenW * 0.0719, screenH * 0.0411) then triggerServerEvent ("skinpagina1stt", localPlayer) end end end end addEventHandler ("onClientClick", root, skinpagina1) -----------------------------------------------------fechar pagina 1 e abrir 2 function f1ab2 (_,state) if painel == true then if state == "down" then if isCursorOnElement(screenW * 0.5325, screenH * 0.7133, screenW * 0.0269, screenH * 0.0467) then triggerServerEvent ("f1ab2stt", localPlayer) removeEventHandler("onClientRender",root,abrir) painel = false addEventHandler ("onClientRender", root,abrir2) pagina2 = true end end end end addEventHandler ("onClientClick", root, f1ab2) -----------------------------------------------------fechar pagina 2 e abrir 3 function f2ab3 (_, state) if painel == true and pagina2 == true and state == "down" then if isCursorOnElement(screenW * 0.5325, screenH * 0.7133, screenW * 0.0269, screenH * 0.0467) then triggerServerEvent("f2ab3stt", localPlayer) removeEventHandler("onClientRender", root, abrir2) painel = false addEventHandler("onClientRender", root, abrir3) pagina3 = true end end end addEventHandler("onClientClick", root, f2ab3) client server-side: function MarkerHit (hitElement) if (getElementType(hitElement)) == "player" then triggerClientEvent(hitElement, "lojaskinstt", getRootElement()) end end function showPanel(thePlayer) accountname = getAccountName(getPlayerAccount(thePlayer)) if isObjectInACLGroup("user." .. accountname, aclGetGroup("Everyone")) then -------- ACL DA SUA CORP triggerClientEvent(thePlayer, "lojaskinstt", getRootElement()) else end end function onResStart() for index, player in ipairs(getElementsByType("player")) do bindKey(player, "", "down", showPanel) end end addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), onResStart) function onPlayerJoin() bindKey(source, "", "down", showPanel) end addEventHandler("onPlayerJoin", getRootElement(), onPlayerJoin) function cleanAll(player) for index, player in ipairs(getElementsByType("player")) do unbindKey(player, "", "down", showPanel) end end addEventHandler("onResourceStop", getResourceRootElement(getThisResource()), cleanAll) --------------------------------------------------------------------------------------- function skinpagina1 () if (getPlayerMoney(source) < 100) then outputChatBox("#000000[ #FF0000Fabrica #000000] #ffffffVoce nao tem dinheiro suficiente $100", source, 255, 255, 255, true) else takePlayerMoney(source, 100) --Remover Dinheiro setPedSkin ( source, 40 ) end end addEvent("skinpagina1stt",true) addEventHandler ( "skinpagina1stt", getRootElement(), skinpagina1 ) ----------------------------------------------------------------------------------fechar pagina 1 abrir 2 function f1ab2() triggerClientEvent(source, "pagina2", resourceRoot) end addEvent("f1ab2stt", true) addEventHandler("f1ab2stt", getRootElement(), f1ab2) ----------------------------------------------------------------------------------fechar pagina 2 abrir 3 function f2ab3() triggerClientEvent(source, "pagina3", resourceRoot) end addEvent("f2ab3stt", true) addEventHandler("f2ab3stt", getRootElement(), f2ab3) server. por algum motivo a pagina 1 e 2 funcionam corretamente porem ao adicionar uma 3 pagina para de funcionar help
  2. local markers1 = { { x=-2405, y=-599, z=132 }, --2405, -599, 132.648 { x=150, y=250, z=15 }, { x=200, y=300, z=20 } } local markers2 = { { x=50, y=100, z=5 }, { x=75, y=125, z=7.5 }, { x=100, y=150, z=10 } } local markers3 = { { x=-50, y=-100, z=5 }, { x=-75, y=-125, z=7.5 }, { x=-100, y=-150, z=10 } } -- Abra o arquivo SQLite local db = dbConnect("sqlite", "estoque.db") -- Crie uma tabela para o conjunto 1 dbExec(db, "CREATE TABLE IF NOT EXISTS estoque_conjunto1 (id INTEGER PRIMARY KEY AUTOINCREMENT, nome TEXT, quantidade INTEGER, gasolina INTEGER)") -- Crie uma tabela para o conjunto 2 dbExec(db, "CREATE TABLE IF NOT EXISTS estoque_conjunto2 (id INTEGER PRIMARY KEY AUTOINCREMENT, nome TEXT, quantidade INTEGER, gasolina INTEGER)") -- Crie uma tabela para o conjunto 3 dbExec(db, "CREATE TABLE IF NOT EXISTS estoque_conjunto3 (id INTEGER PRIMARY KEY AUTOINCREMENT, nome TEXT, quantidade INTEGER, gasolina INTEGER)") function onMarkerHit(hitElement, matchingDimension) if (matchingDimension and getElementType(hitElement) == "player") then local conjunto = getElementData(source, "conjunto") if (not conjunto or conjunto < 1 or conjunto > 3) then outputDebugString("Invalid conjunto specified for marker.") return end local query = "SELECT gasolina FROM estoque_conjunto" .. conjunto .. " WHERE id = 1" local result = dbQuery(db, query) local rows = dbPoll(result, -1) if (not rows or #rows ~= 1) then outputDebugString("Failed to retrieve gasolina value for conjunto " .. conjunto .. ".") outputChatBox("Não foi possível obter a quantidade de gasolina para o conjunto " .. conjunto .. ".", hitElement, 255, 0, 0) else local gasolina = rows[1].gasolina outputChatBox("Este conjunto contém " .. gasolina .. " unidades de gasolina.", hitElement, 0, 255, 0) end end end -- Adicione um event handler para cada marker for _, markerData in ipairs(markers1) do local marker = createMarker(markerData.x, markerData.y, markerData.z, "cylinder", 2, 255, 0, 0, 150) setElementData(marker, "conjunto", 1) addEventHandler("onMarkerHit", marker, onMarkerHit) end for _, markerData in ipairs(markers2) do local marker = createMarker(markerData.x, markerData.y, markerData.z, "cylinder", 2, 255, 0, 0, 150) setElementData(marker, "conjunto", 2) addEventHandler("onMarkerHit", marker, onMarkerHit) end for _, markerData in ipairs(markers3) do local marker = createMarker(markerData.x, markerData.y, markerData.z, "cylinder", 2, 255, 0, 0, 150) setElementData(marker, "conjunto", 3) addEventHandler("onMarkerHit", marker, onMarkerHit) end function addGasolinaCommand(player, command, conjunto, amount) -- Check if the conjunto is valid conjunto = tonumber(conjunto) if (not conjunto or conjunto < 1 or conjunto > 3) then outputChatBox("Por favor, especifique um número de conjunto válido (1, 2 ou 3).", player, 255, 0, 0) return end -- Check if the amount is valid amount = tonumber(amount) if (not amount or amount <= 0) then outputChatBox("Por favor, especifique uma quantidade válida de gasolina para adicionar.", player, 255, 0, 0) return end -- Update the gasolina value for the specified conjunto local query = "UPDATE estoque_conjunto" .. conjunto .. " SET gasolina = gasolina + " .. amount local result = dbExec(db, query) if (not result) then outputDebugString("Failed to update gasolina for conjunto " .. conjunto .. ".") outputChatBox("Não foi possível atualizar a quantidade de gasolina para o conjunto " .. conjunto .. ".", player, 255, 0, 0) else outputChatBox("Adicionado " .. amount .. " unidades de gasolina ao conjunto " .. conjunto .. ".", player, 0, 255, 0) end end -- Register the command addCommandHandler("addgasolina", addGasolinaCommand) teoricamente ao entrar no marker deveria exibir a quantidade de combustivel disponivel no posto porem está exibindo ( Não foi possível obter a quantidade de gasolina para o conjunto ) alguma ideia de como fazer isso funcionar corretamente
  3. --- Server ----- local marker123 = createMarker(589.438, 870.218, -42.497, 'cylinder', 1.0, 30, 144, 255, 150) function marker123(markerHit) setElementData ( source, "Emprego", "Mineirador" ) outputChatBox("/infos para marcar os markers",source,255,255,0) -- Output that they are. end addEventHandler("onPlayerMarkerHit",getRootElement(),marker123) outputchatbox aparecendo em todos os markers do server, alguma ideia de como corrigir?
  4. -- Retorna um valor Numérico, se o jogador possuí o item retorna a quantidade -- que ele possuí, caso contrário retorna 0. --local next = exports.n3xt_inventario --local item = next:getItem(source, "Chocolate") --if (item) and (item >= 1) then -- -- Seu código aqui. --end function fabricarak () if (next:getSpaceMochila(source, "Corpo de AK-47", 1) == true) then local item = next:getItem(source, "Corpo de AK-47") local item = next:getItem(source, "Molas") if (item) and (item >= 1) then next:takeItem(source, "Corpo de AK-47", 1) next:takeItem(source, "Molas", 1) next:giveItem(source, "AK47", 1) end end end addEvent("fabricarakc",true) addEventHandler ( "fabricarakc", getRootElement(), fabricarak ) alguma ideia de como fazer isso funcionar corretamente? do jeito que está ele entrega a arma ao player mesmo ele não tendo todos os itens necessarios
  5. local markers = { {1212.459, -1312.881, 13.556 -1}, {1213.0224609375, -1346.5224609375, 13.572437286377}, {1213.0107421875, -1351.5859375, 13.573674201965}, --preste atenção o ultimo marker não vai virgula no final!!! {1212.9951171875, -1358.228515625, 13.557479858398}, {1212.978515625, -1365.0283203125, 13.524266242981} } -- Coordenadas dos markers addEventHandler ("onResourceStart", resourceRoot, function() for _,pos in ipairs(markers) do local marker = createMarker(pos[1], pos[2], pos[3], 'cylinder', 1.0, 30, 144, 255, 150) --tamanho/cor do marker pode alterar addEventHandler ("onMarkerHit", marker, MarkerHit) local blip = createBlipAttachedTo(marker, 56) --id do blip =56 pode alterar setBlipVisibleDistance(blip, 500) --distancia que é visto o blip no radar, pode alterar end end ) Alguma ideia de como conseguir deixar o marker rente ao chão? o -1 deixa ele no chão mas não abre o painel só abre o painel dos markers que estão "voando"
  6. function getpos (source) x,y,z = getElementPosition(source) interior = getElementInterior(source) Dim = getElementDimension(source) zone = getZoneName(x, y, z, false) city = getZoneName(x, y, z, true) r1,r2,r3 = getElementRotation(source) outputChatBox("Your Rotation is: "..tostring(r1)..", "..tostring(r2)..", "..tostring(r3)..".", source, 0, 255, 0) outputChatBox("You are at: "..tostring(x)..", "..tostring(y)..", "..tostring(z)..".", source, 0, 255, 0) if fileHandle then fileSetPos( fileHandle, fileGetSize( fileHandle ) ) fileWrite(fileHandle, ""..tostring(x)..", "..tostring(y)..", "..tostring(z)..". rotation: "..tostring(r1)..", "..tostring(r2)..", "..tostring(r3)..".") -- write a text line fileFlush(fileHandle) fileClose(fileHandle) end end addCommandHandler("getpos", getpos) Alguma ideia de como fazer funcionar? ele funciona uma vez porem quando executa o comando novamente não funciona como o esperado, gostaria que ele listasse as pos em tabela no txt
  7. local Ped1 = createPed(1, 1370.398, -1291.019, 13.549, 0.529) --Após a cordenada de onde o ped irá ficar ex: 1370.398, -1291.019, 13.549 Adicione uma virgula e pegue a totação, você pode utilizar um resource para isso. duvidas: Stressado#0394
  8. local screenW,screenH = guiGetScreenSize() local resW, resH = 1600,900 local x, y = (screenW/resW), (screenH/resH) local screenWidth, screenHeight = guiGetScreenSize() local webBrowser = createBrowser(screenWidth, screenHeight, false, false) sx,sy = guiGetScreenSize() x,y = (sx/1366), (sy/768) messages = {} editBox = {} editBox.__index = editBox editBox.instances = {} function onClientResourceStart() tick = getTickCount() font = dxCreateFont("gfx/sans-pro-regular.ttf", 20) sound = playSound("sfx/music.mp3",true) g = {} g.user = editBox.new() g.user:setPosition(x*610,y*320,x*213,y*41) g.user.color = {79,86,94,160} g.user.font = font g.user.text = loadLoginFromXML() g.user.visible = true g.user.onInput = function() g.user.color = {87, 95, 104, 160} end g.user.onOutput = function() g.user.color = {79,86,94,160} end g.pass = editBox.new() g.pass:setPosition(x*610,y*390,x*213,y*41) g.pass.color = {79,86,94,160} g.pass.font = font g.pass.masked = true g.pass.visible = true g.pass.onInput = function() g.pass.color = {87, 95, 104, 160} end g.pass.onOutput = function() g.pass.color = {79,86,94,160} end g.rUser = editBox.new() g.rUser:setPosition(x*610,y*320,x*213,y*41) g.rUser.color = {79,86,94,160} g.rUser.font = font g.rUser.onInput = function() g.rUser.color = {87, 95, 104, 160} end g.rUser.onOutput = function() g.rUser.color = {79,86,94,160} end g.rPass = editBox.new() g.rPass:setPosition(x*610,y*390,x*213,y*41) g.rPass.color = {79,86,94,160} g.rPass.font = font g.rPass.masked = true g.rPass.onInput = function() g.rPass.color = {87, 95, 104, 160} end g.rPass.onOutput = function() g.rPass.color = {79,86,94,160} end showChat(false) showCursor(true) addEventHandler("onClientRender", root, paint) end addEventHandler("onClientResourceStart",resourceRoot,onClientResourceStart) function paint() local rh,ry = interpolateBetween(0, (y*559/2)+y*105, 0, y*559, y*105, 0, (getTickCount()-tick)/1400, "Linear") --dxDrawImage(0,0,sx,sy,"gfx/wallpaper.png") dxDrawImage(x*0, y*0, x*1600, y*900, webBrowser, 0, 0, 0, tocolor(255,255,255,255), true) if getTickCount()-tick > 1500 then local bColor = tocolor(6, 255, 0,200) if isMouseInPosition(x*552,y*450,x*262,y*44) then bColor = tocolor(6, 255, 0,200) end dxDrawImage(x*605,y*90,x*199,y*198,"gfx/logo.png",getTickCount()/100,0,0,tocolor(255,255,255,255)) if not inRegisterTab then dxDrawRectangle(x*562,y*320,x*49,y*41,tocolor(40,45,48,160)) dxDrawImage(x*570,y*325,x*33,y*31,"gfx/user.png") dxDrawRectangle(x*562,y*390,x*49,y*41,tocolor(40,45,48,160)) dxDrawImage(x*575,y*395,x*23,y*31,"gfx/pass.png") dxDrawRectangle(x*561,y*450,x*262,y*44,bColor) dxDrawBorder(x*561,y*450,x*262,y*44,tocolor(0,0,0,240),1.4) dxDrawText("Logar",x*561,y*450,x*552+x*262,y*450+y*44,tocolor(255,255,255),y*1,font,"center","center") dxDrawText([[Não tem uma conta? Crie aqui #00ff82Register.]],x*588,y*420,x*588+x*192,y*592+y*43,tocolor(255,255,255),y*0.6,font,"center","center",false,false,false,true) end for k,self in pairs(editBox.instances) do if self.visible then local px,py,pw,ph = self:getPosition() local text = self.masked and string.gsub(self.text,".","•") or self.text local alignX = dxGetTextWidth(text,self.scale,self.font) <= pw and "left" or "right" dxDrawRectangle(px, py, pw, ph, tocolor(unpack(self.color))) dxDrawText(text,px+x*5, py,px-x*5+pw, py+ph,tocolor(unpack(self.textColor)),self.scale,self.font,alignX,"center",true) if self.input and dxGetTextWidth(text,self.scale,self.font) <= pw then local lx = dxGetTextWidth(text,self.scale,self.font)+px+x*8 local lx = dxGetTextWidth(text,self.scale,self.font)+px+x*8 dxDrawLine(lx, py+y*10, lx, py+ph-y*10, tocolor(255,255,255,math.abs(math.sin(getTickCount()/300))*200), 2) end end end if not inRegisterTab then dxDrawBorder(x*561,y*320,x*262,y*41,tocolor(0,0,0,240),1) dxDrawBorder(x*561,y*390,x*262,y*41,tocolor(0,0,0,240),1) else dxDrawRectangle(x*561,y*320,x*49,y*41,tocolor(40,45,48,160)) dxDrawImage(x*570,y*325,x*33,y*31,"gfx/user.png") dxDrawRectangle(x*561,y*390,x*49,y*41,tocolor(40,45,48,160)) dxDrawImage(x*575,y*395,x*23,y*31,"gfx/pass.png") dxDrawBorder(x*561,y*320,x*262,y*41,tocolor(0,0,0,240),1) dxDrawBorder(x*561,y*390,x*262,y*41,tocolor(0,0,0,240),1) dxDrawRectangle(x*561,y*450,x*262,y*44,bColor) dxDrawBorder(x*561,y*450,x*262,y*44,tocolor(0,0,0,240),1.4) dxDrawText("Registre-se",x*561,y*450,x*552+x*262,y*450+y*44,tocolor(255,255,255),y*1,font,"center","center") end end if getKeyState("backspace") then for k,self in pairs(editBox.instances) do if self.visible and self.input then if not keyState then keyState = getTickCount() + 400 self.text = string.sub(self.text,1,string.len(self.text)-1) elseif keyState and keyState < getTickCount() then keyState = getTickCount()+100 self.text = string.sub(self.text,1,string.len(self.text)-1) end return end end keyState = nil end for i, v in pairs(messages) do if v.visible then dxDrawRectangle(sx-dxGetTextWidth(v.text, 1, "default-bold")-10, 35*i, dxGetTextWidth(v.text, 1, "default-bold")+50, 32,v.color) dxDrawBorder(sx-dxGetTextWidth(v.text, 1, "default-bold")-10, 35*i, dxGetTextWidth(v.text, 1, "default-bold")+20, 32,tocolor(255,255,255,200),1.6) dxDrawText(v.text,sx-dxGetTextWidth(v.text,1,"default-bold")-5, 9+35*i, dxGetTextWidth(v.text, 1, "default-bold"), 32, tocolor(255,255,255,255), 1, "default-bold", "left", "top", false, false ,false, true) end end end function onClientClick(button,state,cX,cY) if not isCursorShowing() then return end if button == "left" and state == "up" then for k,self in pairs(editBox.instances) do if self.visible then if self.input then self.input = nil self.onOutput() end local x,y,w,h = self:getPosition() if isMouseInPosition(x,y,w,h) then self.input = true self.onInput() end end end if not inRegisterTab then if isMouseInPosition(x*552,y*450,x*262,y*44) then triggerServerEvent("onRequestLogin",localPlayer,g.user.text,g.pass.text) elseif isMouseInPosition(x*700,y*520,x*44,y*22) then g.user.visible = false g.pass.visible = false inRegisterTab = true g.rUser.visible = true g.rPass.visible = true end else if isMouseInPosition(x*552,y*450,x*262,y*44) then triggerServerEvent("onRequestRegister",localPlayer,g.rUser.text,g.rPass.text) end end end end addEventHandler("onClientClick", root, onClientClick) function onClientCharacter(character) if not isCursorShowing() then return end for k,self in pairs(editBox.instances) do if self.visible and self.input then if (string.len(self.text)) < self.maxLength then self.text = self.text..character end end end end addEventHandler("onClientCharacter", root, onClientCharacter) function editBox.new() local self = setmetatable({}, editBox) self.text = "" self.maxLength = 20 self.scale = y*0.8 self.state = "normal" self.font = "sans" self.color = {255,255,255,220} self.textColor = {255,255,255,220} table.insert(editBox.instances, self) return self end function editBox:getPosition() return self.x, self.y, self.w, self.h end function editBox:setPosition(x,y,w,h) self.x, self.y, self.w, self.h = x,y,w,h return true end function dxDrawBorder(posX, posY,posW,posH,color,scale) dxDrawLine(posX, posY, posX+posW, posY, color, scale,false) dxDrawLine(posX, posY, posX, posY+posH, color, scale,false) dxDrawLine(posX, posY+posH, posX+posW, posY+posH, color, scale,false) dxDrawLine(posX+posW, posY, posX+posW, posY+posH, color, scale,false) end function isMouseInPosition(x,y,width,height) local cx, cy = getCursorPosition() local cx, cy = (cx*sx), (cy*sy) if (cx >= x and cx <= x + width) and (cy >= y and cy <= y + height) then return true else return false end end function onLogin() showChat(true) showCursor(false) stopSound(sound) removeEventHandler("onClientRender", root, paint) removeEventHandler("onClientClick",root,onClientClick) removeEventHandler("onClientCharacter",root,onClientCharacter) end addEvent("onLogin", true) addEventHandler("onLogin", localPlayer, onLogin) function onRegister() g.user.visible = true g.pass.visible = true g.user.text = "" g.pass.text = "" inRegisterTab = false g.rUser.visible = false g.rPass.visible = false g.rUser.text = "" g.rPass.text = "" end addEvent("onRegister", true) addEventHandler("onRegister", localPlayer, onRegister) function loadLoginFromXML() local XML = xmlLoadFile ("userdata.xml") if not XML then XML = xmlCreateFile("userdata.xml", "login") end local usernameNode = xmlFindChild (XML, "username", 0) if usernameNode then return xmlNodeGetValue(usernameNode) else return "" end xmlUnloadFile ( XML ) end function saveLoginToXML(username) local XML = xmlLoadFile ("userdata.xml") if not XML then XML = xmlCreateFile("userdata.xml", "login") end if (username ~= "") then local usernameNode = xmlFindChild (XML, "username", 0) if not usernameNode then usernameNode = xmlCreateChild(XML, "username") end xmlNodeSetValue (usernameNode, tostring(username)) end xmlSaveFile(XML) xmlUnloadFile (XML) end addEvent("saveLoginToXML", true) addEventHandler("saveLoginToXML", root, saveLoginToXML) function login_text(result, text) if result == "sucess" then addNotification(text,1) elseif result == "error" then addNotification(text,2) end end addEvent("login_text",true) addEventHandler("login_text",root,login_text) function addNotification(text, type) text = string.gsub(text,"#%x%x%x%x%x%x","") local i = 0 if text == "" or text == nil or not type then return else for i = 0, #messages+1 do if messages[i] then i = i+1 else messages[i] = {} messages[i].text = text messages[i].visible = true if type == 1 then messages[i].color = tocolor(0,255,0,160) elseif type == 2 then messages[i].color = tocolor(255,0,0,160) end setTimer(removeNotify,5000,1,i) end end end end function removeNotify(i) messages[i].visible = false messages[i] = nil end function dxDrawBorder(posX, posY,posW,posH,color,scale) dxDrawLine(posX, posY, posX+posW, posY, color, scale,false) dxDrawLine(posX, posY, posX, posY+posH, color, scale,false) dxDrawLine(posX, posY+posH, posX+posW, posY+posH, color, scale,false) dxDrawLine(posX+posW, posY, posX+posW, posY+posH, color, scale,false) end estava querendo adicionar um video de fundo na area de login, porem o video não está aparecendo hlp :0
  9. function onInventory(source) if not isGuestAccount(getPlayerAccount(source)) then triggerClientEvent(source, "N3xT.onOpenInventory", source) else messageS(source, "Você precisa estar logado para abrir o inventário!", "error") end end function onResStart() for index, player in ipairs(getElementsByType("player")) do bindKey(player, config.bind, "down", onInventory) if not isGuestAccount(getPlayerAccount(player)) then local acc = getAccountName(getPlayerAccount(player)) loadItens(player, acc) end end end addEventHandler("onResourceStart", resourceRoot, onResStart) function onPlayerJoin() bindKey(source, config.bind, "down", onInventory) end addEventHandler("onPlayerJoin", getRootElement(), onPlayerJoin) function cleanAll() for index, player in ipairs(getElementsByType("player")) do unbindKey(player, config.bind, "down", onInventory) bindKey ( player, "F1", "down", onInventory ) end end addEventHandler("onResourceStop", resourceRoot, cleanAll)
  10. bom esté é o client do meu mod de trancar veiculos, o problema é que nos veiculos da conce, outros jogadores conseguem destrancar os veiculos um dos outros algm tem a moral de me ajudar com isso aqui
  11. local Cortando = math.random(50,125) local locations = { { 1175.446, -2364.027, 12.318 }, { 1214.335, -2344.706, 13.925 }, { 1245.387, -2339.776, 13.828 }, { 1267.052, -2300.626, 12.216 }, { 1313.299, -2285.248, 13.51 }, { 1268.388, -2274.247, 13.451 }, { 1268.388, -2274.247, 13.451 }, { 1223.237, -2282.027, 13.482 }, { 1204.502, -2319.271, 14.705 }, { 1180.061, -2339.961, 13.623 }, { 1143.323, -2359.932, 12.081 }, { 1165.128, -2386.746, 11.187 }, { 1191.322, -2338.888, 13.996 }, { 1217.812, -2329.446, 14.565 }, { 1246.38, -2292.822, 12.783 } } atualrotnumberJORNAL = {} ppcikJORNAL = {} blips = {} rotasJORNAL = { ["Entregas de Jornais - Los Santos (1) - 20 Entregas - $2500"] = { {1175.446, -2364.027, 12.318}, {1214.335, -2344.706, 13.925}, {1245.387, -2339.776, 13.828}, {1267.052, -2300.626, 12.216}, {1313.299, -2285.248, 13.51}, {1268.388, -2274.247, 13.451}, {1268.388, -2274.247, 13.451}, {1223.237, -2282.027, 13.482}, {1204.502, -2319.271, 14.705}, {1180.061, -2339.961, 13.623}, {1143.323, -2359.932, 12.081}, {1165.128, -2386.746, 11.187}, {1191.322, -2338.888, 13.996}, {1217.812, -2329.446, 14.565}, {1246.38, -2292.822, 12.783}, }, ["Entregas de Jornais - Los Santos (2) - 20 Entregas - $3250"] = { (locations [ math.random ( 1, #locations ) ] ) }, } pay = { ["Entregas de Jornais - Los Santos (1) - 20 Entregas - $2500"] = 500, ["Entregas de Jornais - Los Santos (2) - 20 Entregas - $3250"] = 500, } function ifPlayerEnterOnMarker(markerHit,matchingDimension) if isPedInVehicle(source) then if markerHit == ppcikJORNAL[source] then if (matchingDimension) then if isElement(ppcikJORNAL[source]) then local rname = getElementData(source,"rtnameJornal") or nil if rname == nil then return end destroyElement(ppcikJORNAL[source]) triggerClientEvent(source,"AirNew>JOBCortador>blips<Client",source,false) local vh = getPedOccupiedVehicle(source) --toggleAllControls ( source, false ) --setControlState ( source, "handbrake", true ) if atualrotnumberJORNAL[source] <= #rotasJORNAL[rname] then givePlayerMoney(source,Cortando) --exports.Scripts_Dxmessages:outputDx(source, "Entregando Jornais... Aguarde 2 Segundos!", "info") setTimer(gerarrota,1,1,source) setTimer(function(source) exports.Scripts_Dxmessages:outputDx(source, "Você Recebeu + $ e Exp", "success") end,1,1,source) elseif atualrotnumberJORNAL[source] == #rotasJORNAL[rname]+1 then setElementData(source,"rtnameJornal",rname) atualrotnumberJORNAL[source] = 1 local rec = pay[rname] givePlayerMoney(source,tonumber(rec)) local vh = getPedOccupiedVehicle(source) setTimer(function(source) exports.Scripts_Dxmessages:outputDx(source, "Você Recebeu um Valor de $"..rec.." Por Finalizar as Entregas de Jornais!", "success") end,1,1,source) --setTimer(function(source) toggleAllControls ( source, true ) end, 2500,1, source ) --setTimer(function(source) setControlState ( source, "handbrake", false ) end, 2500,1, source ) setElementData(source,"rtnameJornal",nil) end end end end end end addEventHandler("onPlayerMarkerHit",getRootElement(),ifPlayerEnterOnMarker) Olá, alguem poderia me ajudar com esse script? eu queria os check do emprego aleatorios, ent criei o local locations, porem cria apenas 1 check, e quando entro nele finaliza as entregas ao invez se aparecer outro
  12. function voolscomercial () if (getPlayerMoney(source) < PrecoLSComercial) then if tonumber(PrecoLSComercial) then --if (getPlayerMoney(source) < 5) then outputChatBox("#000000[ #FF0000AEROPORTO #000000] #ffffffVocê não tem dinheiro suficiente $"..PrecoLSComercial.."", source, 255, 255, 255, true) else takePlayerMoney(source, ""..PrecoLSComercial.."") --Remover Dinheiro setElementPosition ( source, 1642.058, -2334.951, 13.547 ) outputChatBox("#000000[ #FF0000AEROPORTO #000000] #ffffffVocê acaba de ir para LS por R$"..PrecoLSComercial.." ", player, 255,255,255,true) end end end addEvent("comercials",true) addEventHandler ( "comercials", getRootElement(), voolscomercial ) então na teoria ficaria assim? porem mesmo retornou o mesmo problema no debug, "sou iniciante", vou explicar melhor como estou fazendo o mod pois pode ser algo errado Minha pasta do mod https://imgur.com/JAENiUB dentro do edits está assim PrecoLSComercial = "5000" é dai que estou tirando o PrecoLSComercial que estou colocando no Duff_S server, e que quero colocar na getPlayerMoney
  13. function voolscomercial () if (getPlayerMoney(source) < 5) then outputChatBox("#000000[ #FF0000AEROPORTO #000000] #ffffffVocê não tem dinheiro suficiente $"..PrecoLSComercial.."", source, 255, 255, 255, true) else takePlayerMoney(source, ""..PrecoLSComercial.."") --Remover Dinheiro setElementPosition ( source, 1642.058, -2334.951, 13.547 ) outputChatBox("#000000[ #FF0000AEROPORTO #000000] #ffffffVocê acaba de ir para LS por R$"..PrecoLSComercial.." ", player, 255,255,255,true) end end addEvent("comercials",true) addEventHandler ( "comercials", getRootElement(), voolscomercial ) no caso eu queria adicionar o ( "..PrecoLSComercial.." ) na linha 2 no lugar do numero 5 mas retorna erro no debug (attempt to compare number whit string)
×
×
  • Create New...