Jump to content

#\_oskar_/#

Members
  • Posts

    573
  • Joined

  • Last visited

  • Days Won

    4

#\_oskar_/# last won the day on August 9 2022

#\_oskar_/# had the most liked content!

Details

  • Gang
    N/A
  • Location
    N/A
  • Occupation
    بما انك دخلت بروفايــلي صلي على النبي محمد صل الله عليه وسلم
  • Interests
    N/A

Recent Profile Visitors

6,749 profile views

#\_oskar_/#'s Achievements

Mack

Mack (28/54)

129

Reputation

  1. try this function CreateBtn(config) local self = setmetatable({}, Button) self.x = config.x self.y = config.y self.width = config.width self.height = config.height self.text = config.text or "Button" self.color = config.color or "blue" self.fade = config.fade ~= false self.onClick = config.onClick or false -- // This always returns false, even if I added onClick function. self.alpha = self.fade and 0 or 255 self.fade_step = 15 self.visible = true self.currentColor = Theme.colors.button[self.color].background table.insert(activeButtons, self) return self end function createButton(x,y,w,h,text,color,fade,onClick) return CreateBtn({x=x,y=y,width=w,height=h,text=text,color=color,fade=fade,onClick=onClick}) end local btn1 = createButton(50, 200, 120, 40, "Button 1", "blue", true, function(self) outputChatBox("Clicked Button 1") end) local btn2 = createButton(150, 360, 120, 40, "Button 2", "red", true, function(self) outputChatBox("Clicked Button 2") end) local btn3 = createButton(250, 420, 120, 40, "Button 3", "green", true, function(self) outputChatBox("Clicked Button 3") end) or function createButton(config) local self = setmetatable({}, Button) self.x = config.x self.y = config.y self.width = config.width self.height = config.height self.text = config.text or "Button" self.color = config.color or "blue" self.fade = config.fade ~= false self.onClick = config.onClick or false -- // This always returns false, even if I added onClick function. self.alpha = self.fade and 0 or 255 self.fade_step = 15 self.visible = true self.currentColor = Theme.colors.button[self.color].background table.insert(activeButtons, self) return self end -- // Example.lua, example for using: loadstring(exports.ui:injectModules())() --[[The function name Button must match the actual constructor function, which is createButton. You should call it using createButton({ ... }) instead of Button({ ... }).]] local btn = createButton({ x = 20, y = 60, width = 100, height = 30, text = "Click", color = "blue", fade = true, onClick = function(self) outputChatBox("Clicked the button.") -- // It's not working. end }) If everything is already defined correctly, then please share the code that handles the button click. The code you posted has no issues and works fine.
  2. use Alci's IMG Editor to extract all files. You can download it from this link : Crazy IMG Editor
  3. local hudTexts = {} function createHUDText(text, x, y, fontSize, bgColor, textColor) local hud = {text = text, x = x, y = y, fontSize = fontSize or 1.0, visible = true,bgColor = bgColor or tocolor(0, 0, 0, 200), textColor = textColor or tocolor(255, 255, 255)} table.insert(hudTexts, hud) return hud end function setHUDText(hud, newText) if hud then hud.text = newText end end function setHUDVisible(hud, state) if hud then hud.visible = state end end addEventHandler("onClientRender", root, function() for _, hud in ipairs(hudTexts) do if hud.visible then local w, h = dxGetTextWidth(hud.text, hud.fontSize, "bankgothic") + 20, dxGetFontHeight(hud.fontSize, "bankgothic") + 20 dxDrawRectangle(hud.x, hud.y, w, h, hud.bgColor) dxDrawText(hud.text, hud.x, hud.y, hud.x + w, hud.y + h, hud.textColor, hud.fontSize, "bankgothic", "center", "center") end end end) --HudVariable = createHUDText("Displayed Text", X, Y, FontSize, BackgroundColor, TextColor) -- This function creates an on-screen text inside a box, with customization options for position, font size, background color, and text color. --setHUDVisible(HudVariable,true or false) --show or hide any HUD element --setHUDText(HudJob, "New Job Assigned!") -- Updates the text to "New Job Assigned!" --Example HudDateTime = createHUDText("Date & Time: --/--/-- --:--:-- --", 282, 145, 0.7, tocolor(50, 50, 150, 200), tocolor(255, 255, 255)) HudOwl = createHUDText("Sneaky Owl", 667, 217, 0.8, tocolor(100, 0, 100, 200), tocolor(255, 255, 0)) HudJob = createHUDText("Job: RS Haul Driver", 282, 289, 0.65, tocolor(0, 100, 0, 200), tocolor(255, 255, 255)) setTimer(function() local time = getRealTime() local year, month, day = time.year + 1900, time.month + 1, time.monthday local hours, minutes, seconds = time.hour, time.minute, time.second local ampm = (hours >= 12 and "PM" or "AM") hours = (hours % 12 == 0) and 12 or (hours % 12) setHUDText(HudDateTime, string.format("Date & Time: %04d-%02d-%02d %02d:%02d:%02d %s", year, month, day, hours, minutes, seconds, ampm)) end, 1000, 0)
  4. اكواد لملف lua --usfull fun executeBrowserJavascript_= executeBrowserJavascript function executeBrowserJavascript (br,te) executeBrowserJavascript_(br,"document.getElementById('Call').innerHTML = '" .. te .. "' ") end ------Browser Created------- addEventHandler("onClientBrowserCreated",resourceRoot,function () loadBrowserURL(source, "http://mta/local/index.html") end) -----gui Create-------- local sW, sH = guiGetScreenSize() window = guiCreateWindow(10, (sH - 186) / 2, 337, 186, "", false) guiSetVisible(window , false) local Name = guiGetBrowser(guiCreateBrowser(4, 23, 323, 34,true,true,false,window)) local Money = guiGetBrowser(guiCreateBrowser(4, 57, 323, 34,true,true,false,window)) ----- Send To HTML <span> function BrowserDocumentReady() executeBrowserJavascript (Name,'Yor Name ' ..getPlayerName (localPlayer)) executeBrowserJavascript (Money,'Yor Money ' ..getPlayerMoney (localPlayer)) end ----- open Window bindKey("F1","down",function ( ) guiSetVisible(window,not guiGetVisible(window)) showCursor(guiGetVisible(window)) --- refresh BrowserDocumentReady() end) كود لملف HTML <span style=" color:green; font-family: Arial, Helvetica, sans-serif;font-size : 15px" id="Call" span/> سويته لك بحيث يكون سهل عليك تفهمه بابسط طريقه
  5. data,_add = { },addEventHandler function SColor(e,r,g,b) if getElementType(e) == 'gui-button' then guiSetProperty(e, 'NormalTextColour', string.format("%.2X%.2X%.2X%.2X",r,g,b,255)) end end dxDrawImage_ = dxDrawImage local dxDrawImage = function (...) local a = {...} if isElement( a[1] ) and getElementType( a[1] ) == 'gui-button' and guiGetVisible (a[1]) then data [ a[1] ] = true local posX, posY = guiGetPosition ( a[1] , false ) local width , Height = guiGetSize ( a[1] , false ) dxDrawImage_ (posX , posY, width,Height,a[2], a[3],a[4],a[5], a[6] , a[7]) local r, g, b = getColorFromString("#"..guiGetProperty(a[1], "NormalTextColour")) dxDrawText(guiGetText ( a[1] ) or tostring '',posX, posY, width + posX , Height + posY,SetTextcolor or tocolor(r, g, b,255),1,"default-bold","center","center",false,false,true) guiSetAlpha( a[1] , 0) end if not isElement( a[1] ) then return dxDrawImage_ (...) end end local function Enter() if data [ source ] == true then SColor(source,0 ,255, 0) end end local function Leave() if data [ source ] == true then SColor(source,255, 124,124) end end _add ( "onClientMouseEnter",resourceRoot,Enter) _add ( "onClientGUIMouseUp", resourceRoot,Enter) _add ( "onClientMouseLeave",resourceRoot,Leave) _add ( "onClientGUIMouseDown",resourceRoot,Leave) -----------------\\\\\\\\\\\\\\\\\\\\----------------- event = guiCreateButton(16, 20, 250, 40, "Take", false) guiSetVisible (event, false) addEventHandler ("onClientRender", root, function () dxDrawImage(event ,'img/event.png', 0, 0, 0,tocolor(255, 255, 255, 255), true) -- attach to Button -- dxDrawImage(160, 200, 250, 40 ,'img/event.png', 0, 0, 0,tocolor(255, 255, 255, 255), true) -- dx Image end) bindKey( "k", "down",function( ) guiSetVisible( event , not guiGetVisible( event )) showCursor( guiGetVisible( event )) end ) try this
  6. Hey bro,can u answer in my thread?

  7. -- مود الايدي الي اسوي منه export local optimize = true -- Should the script be optimized? (if optimized, cannot be used client-side) local ids = {} function assignID() for i=1,getMaxPlayers() do if not ids[i] then ids[i] = source setElementData(source,"id",i,not optimize) break end end end addEventHandler("onPlayerJoin",root,assignID) function startup() for k, v in ipairs(getElementsByType("player")) do local id = getElementData(v,"id") if id then ids[id] = v end end end addEventHandler("onResourceStart",resourceRoot,startup) function getPlayerID(player) for k, v in ipairs(ids) do if v == player then return k end end end function freeID() local id = getElementData(source,"id") if not id then return end ids[id] = nil end addEventHandler("onPlayerQuit",root,freeID) function getPlayerByID(id) local player = ids[id] return player or false end -- ابيه يجيب ايدي اللاعب -- Client function mid ( player, commandName ) outputChatBox("Your ID IS"..getPlayerID(player), player, 0, 154, 255) end addCommandHandler ( "myid", mid )
  8. function WalkingByAcl(ThePlayer,style,group) if isObjectInACLGroup("user."..getAccountName ( getPlayerAccount(ThePlayer)), aclGetGroup(group or "Admin")) then setPedWalkingStyle(ThePlayer,style or 0) end end ------------------ addEventHandler("onPlayerLogin",root,function () WalkingByAcl(source,69,'Admin') end) local function startedResource() for key,ThePlayer in ipairs(getElementsByType("player")) do WalkingByAcl(ThePlayer,69,'Admin') end end addEventHandler("onResourceStart",resourceRoot,startedResource)
  9. function changeWalkStyle(ThePlayer, command) if isObjectInACLGroup("user."..getAccountName ( getPlayerAccount(ThePlayer)), aclGetGroup("Admin")) then setPedWalkingStyle(ThePlayer,69) end end addCommandHandler("WalkingStyle", changeWalkStyle)
  10. This is the error replace it if isMouseInPosition(sx*.41, sy*.25, sx*.10, sy*.06) then
  11. You mean like that? function AttachDxToGuiElement( GUIElement , img ) if ( guiGetVisible ( GUIElement ) ) then local x, y = guiGetPosition ( GUIElement , false ) local width , Height = guiGetSize ( GUIElement , false ) dxDrawImage(x, y, width , Height ,img, 0, 0, 0,SetImagecolor or tocolor(255, 0, 0, 255), true) dxDrawText(guiGetText ( GUIElement ) or tostring '',x, y, width + x , Height + y,SetTextcolor or tocolor(55,55,55,255),1,"default-bold","center","center",false,false,true) guiBringToFront ( GUIElement ) guiSetAlpha ( GUIElement , 0) end end ------------------ event = guiCreateButton(16, 20, 250, 40, "Take", false) addEventHandler ("onClientRender", root, function () AttachDxToGuiElement( event ,'img/event.png' ) end) bindKey( "k", "down",function( ) guiSetVisible( event , not guiGetVisible( event )) showCursor( guiGetVisible( event )) end )
  12. If you want to attach in the object dxCreateRenderTarget dxSetRenderTarget dxCreateShader dxSetShaderValue engineApplyShaderToWorldTexture or you mean this? DxDrawTextOnElement
×
×
  • Create New...