Jump to content

BogdanRTB

Members
  • Posts

    15
  • Joined

  • Last visited

Recent Profile Visitors

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

BogdanRTB's Achievements

Square

Square (6/54)

2

Reputation

  1. dgs = exports.dgs local startup = true local ladderState = false local ladderHgt = 0 local ladderExt = 0 local ladderRot = 180 function makeGUI() if not getPedOccupiedVehicle(localPlayer) then outputChatBox( "Aceasta comanda nu functioneaza daca nu esti intr-o masina de tip ladder!", 255, 194, 14 ) return end if getElementModel(getPedOccupiedVehicle(localPlayer)) == 544 and (not controlPanel) then local firetruckElement = getPedOccupiedVehicle (localPlayer) local ladderHeight = 0 local ladderExt = 0 local ladderRot = 0 if getElementData(firetruckElement, "fdladder:height") then ladderHeight = getElementData(firetruckElement, "fdladder:height") end if getElementData(firetruckElement, "fdladder:extend") then ladderExt = getElementData(firetruckElement, "fdladder:extend") end if getElementData(firetruckElement, "fdladder:rotation") then ladderRot = getElementData(firetruckElement, "fdladder:rotation") end local width, height = 195, 210 local sx, sy = guiGetScreenSize() local posX = (sx/2)-(width/2) local posY = (sy/2)-(height/2) local screenW, screenH = guiGetScreenSize() controlPanel = dgs:dgsCreateWindow((screenW - 262) / 2, (screenH - 339) / 2, 262, 339, "Meniu Control Scara", false) dgs:dgsWindowSetSizable(controlPanel, false) imageUp = dgs:dsgCreateImage(96, 72, 59, 63, "ladder_truck/img/ladder-upc.png", false, controlPanel) imageLeft = dgs:dgsCreateImage(36, 135, 60, 63, "ladder_truck/img/ladder-leftc.png", false, controlPanel) imageDown = dgs:dgsCreateImage(96, 198, 59, 63, "ladder_truck/img/ladder-downc.png", false, controlPanel) imageRight = dgs:dgsCreateImage(155, 135, 59, 63, "ladder_truck/img/ladder-rightc.png", false, controlPanel) closeButton = dgs:dgsCreateButton(204, 301, 34, 19, "X", false, controlPanel) guiSetProperty(closeButton, "NormalTextColour", "FFAAAAAA") imageIn = dgs:dgsCreateImage(96, 261, 60, 63, "ladder_truck/img/ladder-inc.png", false, controlPanel) imageOut = dgs:dgsCreateImage(95, 10, 60, 63, "ladder_truck/img/ladder-outc.png", false, controlPanel) showCursor(true) dgs:dgsWindowSetSizable (controlPanel, false) dgs:dgsWindowSetMovable (controlPanel, true) elseif (controlPanel and (not dgs:dgsGetVisible(controlPanel))) then dgs:dgsSetVisible(controlPanel, true) showCursor(true) elseif (controlPanel and dgs:dgsGetVisible(controlPanel)) then dgs:dgsSetVisible(controlPanel, false) showCursor(false) end end addCommandHandler("lc", makeGUI) addEventHandler( "onClientMouseEnter", root, function() if (source == imageUp) then dgs:dgsImageSetImage( source, "ladder_truck/img/ladder-up.png") elseif (source == imageRight) then dgs:dgsImageSetImage( source, "ladder_truck/img/ladder-right.png") elseif (source == imageLeft) then dgs:dgsImageSetImage( source, "ladder_truck/img/ladder-left.png") elseif (source == imageDown) then dgs:dgsImageSetImage( source, "ladder_truck/img/ladder-down.png") elseif (source == imageIn) then dgs:dgsImageSetImage( source, "ladder_truck/img/ladder-in.png") elseif (source == imageOut) then dgs:dgsImageSetImage( source, "ladder_truck/img/ladder-out.png") end end ) addEventHandler( "onClientMouseLeave", root, function() if (source == imageUp) then dgs:dgsImageSetImage( source, "ladder_truck/img/ladder-upc.png") elseif (source == imageRight) then dgs:dgsImageSetImage( source, "ladder_truck/img/ladder-rightc.png") elseif (source == imageLeft) then dgs:dgsImageSetImage( source, "ladder_truck/img/ladder-leftc.png") elseif (source == imageDown) then dgs:dgsImageSetImage( source, "ladder_truck/img/ladder-downc.png") elseif (source == imageIn) then dgs:dgsImageSetImage( source, "ladder_truck/img/ladder-inc.png") elseif (source == imageOut) then dgs:dgsImageSetImage( source, "ladder_truck/img/ladder-outc.png") end end ) function closeGUI () if (source == closeButton) then destroyElement(guiRoot) showCursor(false) controlPanel = nil end end addEventHandler ( "onClientGUIClick", getRootElement(), closeGUI) function ladderControl(btn, state) if (source == imageUp) then if (ladderHgt == -69) then return end ladderHgt = ladderHgt - 3 triggerServerEvent("changeHeight", localPlayer, ladderHgt, true) elseif (source == imageDown) then if (ladderHgt == 0) then return end ladderHgt = ladderHgt + 3 triggerServerEvent("changeHeight", localPlayer, ladderHgt, true) elseif (source == imageLeft) then ladderRot = ladderRot + 5 triggerServerEvent("changeRotation", localPlayer, ladderRot, true) elseif (source == imageRight) then ladderRot = ladderRot - 5 triggerServerEvent("changeRotation", localPlayer, ladderRot, true) elseif (source == imageIn) then if (ladderExt == 0) then return end ladderExt = ladderExt + 0.5 triggerServerEvent("changeLength", localPlayer, ladderExt, true) elseif (source == imageOut) then if (ladderExt == -6) then return end ladderExt = ladderExt - 0.5 triggerServerEvent("changeLength", localPlayer, ladderExt, true) end end addEventHandler( "onClientGUIClick", root, ladderControl) I just heard out about dgs and this is my first script I tried to translate to DGS but some of the DGS GUI doesn't load, what I did wrong in the code? Okay, I resolved the events but I can't resolve a thing There is now appearing a new close button on the panel and The bottom one doesn't work, how can I configure the button up on the pannel? Or how to dezactivate it
  2. Yeah but I don't know how to create GUIS with DGS because on the geditor resource I use for creating them I don't have DGS I have only DX and Normal GUI
  3. I am not talking about DGS, I am talking about DX because I can't find any onClientClick event for it
  4. Thanks! If I will have any questions I will ask you Do you know how I can make the dx panel to disappear when I click on a dgs rectangle because I can't find any funciton for onDXRectangleClicked or something like this
  5. Hello, I just maked a script and I don't know why the dx gui don't appear when I type the command This is the code: localPlayer = getLocalPlayer() local myMarker = createMarker( 2286.2451171875, -5.3291015625, 25.484375, "cylinder", 2, 255, 166, 0, 255) local x, y, z = 2249.50390625, -89.0283203125, 26.484375 local dxfont0_dca = dxCreateFont(":cache/dca.ttf", 25) local panel = nil function dx_draw_buycar_info() if ( getDistanceBetweenPoints3D ( x, y, z, getElementPosition ( localPlayer ) ) ) < 50 then local coords = { getScreenFromWorldPosition ( x, y, z ) } if coords[1] and coords[2] then dxDrawText("#112192Inchirieri#ffffff\nFoloseste /rentveh pentru a inchiria un vehicul", coords[1], coords[2], coords[1], coords[2], tocolor(255,255,255), 1.5, "default-bold", "center", "center", false, false, false, true, false ) end end end addEventHandler("onClientRender", root, dx_draw_buycar_info) function rentVeh() if panel == "dealership" then dxDrawRectangle(581, 280, 755, 476, tocolor(136, 127, 118, 230), false) --dxDrawText("Ialomita Transport Public - Inchiriere Vehicule", 582, 283, 1337, 331, tocolor(17, 33, 146, 230), 1.00, dxfont0_dca, "center", "center", false, false, false, false, false) dxDrawLine(713, 333, 1203, 333, tocolor(17, 33, 146, 230), 1, false) dxDrawRectangle(600, 367, 223, 276, tocolor(77, 72, 67, 254), false) --dxDrawImage(605, 372, 212, 265, ":poze/lucrator.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawRectangle(845, 367, 223, 276, tocolor(77, 72, 67, 254), false) dxDrawRectangle(1092, 367, 223, 276, tocolor(77, 72, 67, 254), false) --dxDrawImage(850, 372, 212, 265, ":poze/lucrator.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) --dxDrawImage(1098, 372, 212, 265, ":poze/lucrator.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawRectangle(852, 657, 210, 50, tocolor(77, 72, 67, 254), false) dxDrawRectangle(607, 657, 210, 50, tocolor(77, 72, 67, 254), false) dxDrawRectangle(1098, 657, 210, 50, tocolor(77, 72, 67, 254), false) dxDrawText("Inchiriaza", 607, 658, 817, 707, tocolor(255, 255, 255, 255), 2.00, "default-bold", "center", "center", false, false, false, false, false) dxDrawText("Inchiriaza", 852, 658, 1062, 707, tocolor(255, 255, 255, 255), 2.00, "default-bold", "center", "center", false, false, false, false, false) dxDrawText("Inchiriaza", 1098, 658, 1308, 707, tocolor(255, 255, 255, 255), 2.00, "default-bold", "center", "center", false, false, false, false, false) dxDrawRectangle(907, 727, 108, 24, tocolor(77, 72, 67, 254), false) dxDrawText("Inchide", 907, 728, 1015, 751, tocolor(17, 33, 146, 230), 1.50, "default", "center", "center", false, false, false, false, false) end end function buy_vehicle() if ( getDistanceBetweenPoints3D ( x, y, z, getElementPosition ( localPlayer ) ) ) < 5 then panel = "dealership" end end addCommandHandler("rentveh", buy_vehicle)
  6. Thanks both of you now it works!
  7. I want his opacity to change from 255 to 0 wait 1 sec and than change back to 255 and than wait 2 seconds and repeat the process Like how the triangle beep in this video
  8. Actually I added bleepColor in the dxDrawImage and the result was that image (Triangle just gets under the whitebg whitout doing any beep
  9. It still doesn't work it now appears just under the white background (Orange Triangle is the dxImage that I want to make to Bleep) And this is the serverside --[[ server.lua Allows server administrators to create banner annoucements ]] mysql = exports.mysql integration = exports.integration pool = exports.pool -- Admin announcement addCommandHandler("roalert", function(player, commandName, ...) local isLoggedIn = getElementData(player, "loggedin") == 1 if isLoggedIn and (integration:isPlayerTrialAdmin(player) or integration:isPlayerSupporter(player)) then if not (...) then outputChatBox("Comanda: /" .. commandName .. " [Mesaj]", player, 255, 194, 14) return end local message = table.concat({ ... }, " ") local players = exports.pool:getPoolElementsByType("player") local username = getPlayerName(player) for _, arrayPlayer in ipairs(players) do if integration:isPlayerTrialAdmin(player) then triggerClientEvent(arrayPlayer, "rl:post", arrayPlayer, "" .. message, 255, 194, 14, 1) outputChatBox("[RO-ALERT] "..message.."", player, 255, 255, 255) elseif integration:isPlayerSupporter(player) then triggerClientEvent(arrayPlayer, "rl:post", arrayPlayer, "" .. message, 255, 100, 150, 1) outputChatBox("[RO-ALERT] "..message.."", player, 255, 255, 255) end end outputConsole("Adm/SUPCmd: " .. message) exports.global:sendMessageToAdmins("Adm/SUPCmd: " .. username .. " a facut un ro-alert") exports.logs:dbLog(player, 4, player, "ANN " .. message) end end, false, false )
  10. Okay but I have some issues at calling it because it is triggered by a event handler This is the basic script without any other added --TEST local sx, sy = guiGetScreenSize() -- dx stuff local textString = "" local show = false local r, b, g = 255, 255, 255 local posX = sx local stringLegth = 0 local speed = 1 local alphaBG = 0 local fadeSpeed = 0.5 local height = 25 function drawAnnText() if show then setElementData(localPlayer, "annHeight", height, false) if (getPedWeapon(localPlayer) ~= 43 or not getPedControlState(localPlayer, "aim_weapon")) then dxDrawImage(1639, 429, 267, 550, "poze/tel.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawImage(1649, 529, 252, 323, "poze/bgroalert.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawImage(1673, 559, 39, 36, "poze/warning.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawText("RO-ALERT", 1716, 562, 1822, 595, tocolor(36, 36, 36, 255), 1.40, "sans", "left", "center", false, false, false, true, false) dxDrawText("Primit: 21 sept., 10:15", 1668, 604, 1844, 635, tocolor(36, 35, 35, 255), 1.00, "default-bold", "left", "center", false, false, false, false, false) dxDrawText(textString, 1668, 651, 1878, 805, tocolor(36, 35, 35, 255), 1.20, "default-bold", "left", "top", false, true, false, false, false) end if alphaBG < 100 then alphaBG = alphaBG + fadeSpeed end if (posX + stringLegth) < 0 then if alphaBG < 0 then alphaBG = alphaBG - fadeSpeed else show = false removeEventHandler("onClientRender", getRootElement(), drawAnnText) setElementData(localPlayer, "annHeight", 0, false) end else posX = math.floor(posX - speed) end end end local function handleClick(button, state, absX, absY) if button == 'left' and state == 'down' and show and #textString > 0 then -- make sure it's not just at the border, since that might sometimes be buggy. if absX > 0 and absX < sx and absY > 0 and absY <= height then -- check if it contains an URL local url = exports.global:getUrlFromString(textString) if url and setClipboard(url) then outputChatBox('Copiat "' .. url .. '".') end end end end addEventHandler('onClientClick', root, handleClick) function postAnn(msg, r1, b1, g1, playsound) if msg and (string.len(msg) > 0) then if playsound and tonumber(playsound) and (tonumber(playsound) > 0) then playSound(playsound .. ".mp3") end alphaBG = 0 textString = msg stringLegth = string.len(textString) * 11 posX = sx if r1 and b1 and g1 then r, b, g = r1, b1, g1 end show = true addEventHandler("onClientRender", getRootElement(), drawAnnText) end end addEvent("rl:post", true) addEventHandler("rl:post", getRootElement(), postAnn)
  11. Does anyone know how to make a dxImage to beep like disappear-appear infinity in the all time that the dx gui is called?
  12. Very nice server! Better roleplay than top servers like ls:rp or rc:rp
×
×
  • Create New...