Jump to content

Murilo_apa

Members
  • Posts

    22
  • Joined

  • Last visited

Recent Profile Visitors

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

Murilo_apa's Achievements

Civilian

Civilian (7/54)

0

Reputation

  1. function giveV(player, car_id) if player and isElement(player) then if car_id and type(car_id) == 'number' then local _,i = hasV(player, car_id) local garagem = getElementData(player, 'conce.garage') or {} if i then outputChatBox('Você já tem este carro!') --infobox return false else table.insert(garagem, {id = car_id}) setElementData(player, 'conce.garagem', garagem) outputChatBox('Você adquiriu um '..vehicle[car_id].name..'.') --infobox return true end else outputDebugString('Aguardando arg #2 válido para a function hasV') return false end else outputDebugString('Aguardando arg #1 válido para a function hasV') return false end end I'm struggling to make a dealership script, but the giveV function doesn't add the car to the garage list even if the checks pass. Can anyone help?
  2. How? it work... I gonna study this Very thanks man
  3. Yesterday I tried a help with the forum community but it didn't work, so I realized that the error was not what I was saying, but even so I think I'm too dumb to be able to do that. I can't synchronize the scroll with select. Someone help me? Sorry for the inconvenience. This is my current code: local espace = 0.0052 local screenW, screenH = guiGetScreenSize() local rx, ry = screenW * 0.2079, screenH * 0.5599 local render = dxCreateRenderTarget(rx, ry, true) local scroll = 0.0000 local scrollV = 0.0255 local maxScroll = 0.0000 local selected = nil local slots = {} local cx, cy = screenW * 0.3960, screenH * 0.2214 local bx, by = (screenW/2) - (rx/2), (screenH/2) - (ry/2); local Color = tocolor(140, 140, 140, 150) local selectedColor = tocolor(0, 200, 255, 200) function drawInv() if render and isElement(render) then showCursor(true) local x, y = 0.0029, 0.0052 dxDrawRectangle(cx, cy, rx, ry, tocolor(0, 0, 0, 100), false) dxSetRenderTarget(render, true) for i=1,50 do dxDrawRectangle(screenW * x, screenH * (y - scroll), screenW * 0.0483, screenH * 0.0872, i == selected and selectedColor or Color) dxDrawImage(screenW * (x + 0.0050), screenH * ((y + 0.0100) - scroll), screenW * (0.0483 - 0.0100), screenH * (0.0872 - 0.0200), 'img/agua.png', 0, 0, 0, tocolor(255, 255, 255, 255), false) table.insert(slots, {screenW * x, screenH * (y - scroll), screenW * 0.0483, screenH * 0.0872}) x = x + 0.0512 if x >= 0.1823 then x = 0.0029 y = y + 0.0920 end maxScroll = y - 0.4727 + espace end dxSetRenderTarget() dxDrawImage(cx, cy, rx, ry, render) end end addEventHandler('onClientRender', root, drawInv) function scrollRoller(b, p) if p then if b == 'mouse_wheel_up' then scroll = math.max(0, scroll - scrollV) elseif b == "mouse_wheel_down" then scroll = math.min(maxScroll, scroll + scrollV) end end end addEventHandler('onClientKey', root, scrollRoller) function clickSelect(b, s) if s == 'down' then if b == 'left' then for i,v in ipairs(slots) do if isMouseInPosition(cx, cy, rx, ry) then if isMouseInPosition(v[1] + cx, v[2] + cy, v[3], v[4]) then selected = i break end end end end end end addEventHandler('onClientClick', root, clickSelect) And the video about what is the problem:
  4. So I'm trying to do an inventory script and I'm having a problem with the dxTarget scaling. https://youtu.be/rCihMvRlvBs local screenW, screenH = guiGetScreenSize() local render = dxCreateRenderTarget(screenW * 0.3994, screenH * 0.2652) local cx, cy = (screenW/2) - ((screenW * 0.3994) / 2), (screenH/2) - ((screenH * 0.2652) / 2) local scroll = 0.0000 local scrollV = 0.0255 local maxScroll = 0.0000 local selected = 47 local slots = {} local Color = tocolor(140, 140, 140, 150) local selectedColor = tocolor(0, 200, 255, 200) function dxInv() if render and isElement(render) then showCursor(true) dxDrawRoundedRectangle(screenW * 0.3994, screenH * 0.2652, screenW * 0.2012, screenH * 0.4697, 10, tocolor(0, 0, 0, 80), false) x, y = 0.0050, 0.0040 local load = getElementData(localPlayer, 'inv.mochila') slots = {} dxSetRenderTarget(render, true) for i=1,24 do dxDrawRectangle(screenW * x, screenH * (y - scroll), screenW * 0.0920, screenH * 0.0470, i == selected and selectedColor or Color, false) table.insert(slots, {screenW * x, screenH * (y - scroll), screenW * 0.0920, screenH * 0.0470}) dxDrawImage(screenW * (x + 0.0100), screenH * ((y + 0.0070) - scroll), screenW * 0.0700, screenH * 0.0350, "img/agua.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) x = x + 0.0990 if x >= 0.3850 then x = 0.0050 y = y + 0.0495 end end maxScroll = y - 0.2152 dxSetRenderTarget() dxDrawImage(screenW * 0.3994, screenH * 0.2652, screenW * 0.2012, screenH * 0.4697, render) end end addEventHandler('onClientRender', root, dxInv) function scrollRoller(b, p) if p then if b == 'mouse_wheel_up' then scroll = math.max(0, scroll - scrollV) elseif b == 'mouse_wheel_down' then scroll = math.min(maxScroll, scroll + scrollV) end end end addEventHandler('onClientKey', root, scrollRoller) function clickSelect(b, s) if s == 'down' then if b == 'left' then for i,v in ipairs(slots) do if isMouseInPosition(v[1] + cy, v[2] + cx, v[3], v[4]) then selected = i end end end end end addEventHandler('onClientClick', root, clickSelect)
  5. it dont work! i don't undertand
  6. I can't verify if the vehicle's id is the same as the spawned one and if it's going to destroy it! addEvent('onPlayerRequestSpawnV', true) addEventHandler('onPlayerRequestSpawnV', root, function(vid) local x,y,z = getElementPosition(source); local _,_,r = getElementRotation(source); local spawnedV = getElementData(source, 'conce.garagem.spawneds') or {}; for i,v in ipairs(spawnedV) do if i.vidC == vid then if i.vh and isElement(i.vh) then destroyElement(i.vh) return false; end end end vehicleSV = createVehicle(vid, x,y,z,_,_,r) warpPedIntoVehicle(source, vehicleSV) table.insert(spawnedV, {vidC = vid, vh = vehicleSV}) end); This is my current code...
  7. How I can persist position data? This is my current code: function saveAccountData() local position = getElementPosition(source) setAccountData(account, 'accountData.position', position) end addEventHandler('onResourceStop', root, function() for i,player in ipairs(getElementsByType('player')) do local position = getElementPosition(player) if not isGuestAccount(account) then setAccountData(account, 'accountData.position', position) end end end) function loadAccountData(_, account local positiondata = getAccountData(account, 'accountData.position') local position = tonumber(positiondata) if position then setElementPosition(source, position) end end addEventHandler('onPlayerQuit', root, saveAccountData) addEventHandler('onPlayerLogin', root, loadAccountData)
  8. Brooooh! you're a god ┗|`O′|┛ Thank you veeeery much for your patience and sorry for the lack of information! LOV U
  9. the element comes from the server side script when the element is on the marker. function dxConce() if exibindo_painelC == false then if cooldown[element] and tick - cooldown[element] < 5000 then return end cooldown[element] = tick -- this line addEventHandler("onClientRender", root, drawConce) exibindo_painelC = true bindKey('backspace','down', function() if exibindo_painelC == true then removeEventHandler("onClientRender", root, drawConce) setCameraTarget (localPlayer) exibindo_painelC = false end end) end end does not work ?
  10. Estou com dificuldades para fazer um script de atendido , quando o player está no marcador os dx ao lado do setCameraMatrix são chamados, e quando o backspace é engolido, na teoria era para retirar o EventHandler e voltar tudo ao normal. O cooldown seria evitar um loop, the script is of type client and the player comes from client side script.
  11. an error appears... ERROR: table index is null
  12. Didn't work... ERROR: attempt to index upvalue 'cooldown' (a number value)
  13. local cooldown = {} local tick = getTickCount() function dxConce() if exibindo_painelC == false then if cooldown[element] and tick - cooldown[element] < 5000 then return end cooldown = tick addEventHandler("onClientRender", root, drawConce) exibindo_painelC = true bindKey('backspace','down', function() if exibindo_painelC == true then removeEventHandler("onClientRender", root, drawConce) setCameraTarget (localPlayer) exibindo_painel = false end end) end end Help me please! after I enter the marker for the first time it stops working! looks like an error with the cooldown, but I can't identify it (I'm using the translator).
×
×
  • Create New...