Jump to content

mafioz

Members
  • Posts

    81
  • Joined

  • Last visited

Everything posted by mafioz

  1. --Server Side function getrp() local randomP = getRandomPlayer() triggerClientEvent(source, "getRandPlayer", source, randomP) end addEvent("StartRandom", true) addEventHandler("StartRandom", resourceRoot, getrp) --Client Side function dxUI(randomP) ui["BG"] = dxDrawImage(x*741,0,x*619,y*487,"files/BG.png") ui["title"] = dxDrawText(title, 0, y*70, x*1340, 0, tocolor(255, 255, 255, 255), 1, titleFont, "right") ui["playerWon"] = dxDrawText(tostring(getPlayerName(randomP)), x*860, y*242,0,0, tocolor(255, 255, 255, 255), 1, playerFont) end addEvent("getRandPlayer", true) addEventHandler("getRandPlayer", root, dxUI) function ghore(CMD, ...) if (ghoreStatus == 0) then ghoreStatus = 1 local EnteredTitle = table.concat ( { ... }," " ) title = tostring(EnteredTitle) addEventHandler("onClientRender", getRootElement(), dxUI) triggerServerEvent("ElameShorueGhore", root) triggerServerEvent("StartRandom", root) end end addCommandHandler("ghore", ghore)
  2. addCommandHandler("bootveh",function(player,_,plate) if not plate then return end local vehicle = getVehicleFromPlate(plate) if vehicle then local state = isElementFrozen(vehicle) setElementFrozen(vehicle, not state) if state then outputChatBox("Unfrozen",player,255,255,255,true) else outputChatBox("Frozen",player,255,255,255,true) end else outputChatBox("Vehicle not found",player,255,255,255,true) end end) function getVehicleFromPlate(plate) if not tostring(plate) then return end for _, vehicle in ipairs(getElementsByType("vehicle")) do if (getVehiclePlateText(vehicle) == plate) then return vehicle end end return false end
  3. Hi. The second argument to addCommandHandler must be equal to the bound function. Just add a second addCommandHandler. addCommandHandler("tps", openLocationManager) addCommandHandler("places", openLocationManager)
  4. Greetings! You can create a sphere and attach it to the player on the client side, then you can control the elements entering the sphere (that is, the closest elements)
  5. 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) slots[i] = {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) Try this
  6. Server: function VoteSystem(title) outputChatBox ("Your Vote Title: " .. title, client) end addEvent("VoteConnection", true) addEventHandler("VoteConnection", resourceRoot, VoteSystem) Client: sx, sy = guiGetScreenSize() ClientGUI = {} function VoteCommand (commandName, ...) local title = table.concat ( { ... }," " ) TextDraw = tostring(title) triggerServerEvent ( "VoteConnection", resourceRoot, tostring(title) ) addEventHandler("onClientRender",root,render) outputChatBox(title) end addCommandHandler ( "vote", VoteCommand ) function render() ClientGUI[2] = dxDrawRectangle(sx*0.2, sy*0.3, sx*0.6, sy*0.5, tocolor(0,0,0,150)) ClientGUI[1] = dxDrawText(TextDraw, sx*0.21, sy*0.31, sx, sy, tocolor(255,0,0,255), 2) if not ClientGUI[3] then -- create static image end end)
  7. 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], v[2], v[3], v[4]) then selected = i end end end end end addEventHandler('onClientClick', root, clickSelect)
  8. You have to find the file and edit the coordinates there, but you can also use the following code without finding the file you need: local spawn = { position = { 0, 0, 3 }, rotation = 90, skin = 124, -- skin ID int = 0, -- interior dim = 0, -- dimension } addEventHandler("onPlayerLogin",root,function() local x, y, z = unpack(spawn.position) setTimer(spawnPlayer,500,1,source,x,y,z,spawn.rotation,spawn.skin,spawn.int,spawn.dim) end)
  9. Hello. I would like to help you, but I do not quite understand what you need. Can you write details?
  10. It would be nice if you posted the whole function and as code instead of text
  11. mafioz

    Help me

    Thanks, maybe this is what you need, I'll check later)
  12. mafioz

    Help me

    How to disable the collision of the car or the player so that the physics remains? After using SetElementCollisionsEnabled the elements have no physics
  13. did you mean that? -- client side function test() outputChatBox("Test") end bindKey("o","down",test)
  14. 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 v.vidC == vid then if v.vh and isElement(v.vh) then destroyElement(v.vh) return false; end end end vehicleSV = createVehicle(vid, x,y,z,_,_,r) warpPedIntoVehicle(source, vehicleSV) table.insert(spawnedV, {vidC = vid, vh = vehicleSV}) setElementData(source, 'conce.garagem.spawneds', spawnedV) end); Try this
  15. 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 v.vidC == vid then if v.vh and isElement(v.vh) then destroyElement(v.vh) return false; end end end vehicleSV = createVehicle(vid, x,y,z,_,_,r) warpPedIntoVehicle(source, vehicleSV) table.insert(spawnedV, {vidC = vid, vh = vehicleSV}) end); Hm..
  16. function save (player) local x, y, z = getElementPosition(player) setAccountData(getPlayerAccount(player), "save:lastpos", toJSON({x, y, z})) end function load (player) local pos = getAccountData(getPlayerAccount(player), "save:lastpos") if not pos then return end local x, y, z = unpack(fromJSON(pos)) setElementPosition(player, x, y, z) end addEventHandler ("onPlayerLogin", root, function() load (source) end) addEventHandler ("onPlayerQuit", root, function () save (source) end) addEventHandler ("onResourceStop", resourceRoot, function() for _, player in ipairs (getElementsByType("player")) do save(player) end end)
  17. local serials = { "your serial..", } -- And put this condition in your opening function if not serials[getPlayerSerial(player/localPlayer)] then return end
  18. If more issues come up, create a new thread and tag me. I'll be glad to help!
  19. local cooldown function dxConce() if exibindo_painelC == false then if cooldown and (getTickCount() - cooldown) < 5000 then return end cooldown = getTickCount() 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 Sorry, I do not know English, and with the help of a translator, I did not quite understand you. last try
  20. You did not answer my question local cooldown = {} function dxConce() if exibindo_painelC == false then if cooldown and (getTickCount() - cooldown) < 5000 then return end cooldown = getTickCount() 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 Try this then
  21. Muito estranho.. Isso causa algum erro de depuração?
×
×
  • Create New...