Jump to content

mateplays

Members
  • Posts

    11
  • Joined

  • Last visited

Recent Profile Visitors

271 profile views

mateplays's Achievements

Square

Square (6/54)

1

Reputation

  1. You are my saviour. Thank you very much, now it works! Happy holidays. Hungarian: Köszi szépen, kellemes ünnepeket.
  2. Okay, I moved style up, but... Still not working. <html><head> <meta charset="UTF-8"> <style id="theStyle">* { font-size: 95% !important; } .nocolor { font-size: 80% !important; } .right { text-align: right; float: right; background: rgba(124, 197, 118, 0.85); margin-left: 10px !important; } .center { text-align: center; float: center; background: rgba(232, 30, 67, 0.85); margin: 0 auto; } .left { text-align: left; float: left; background: rgba(89, 142, 215, 0.85); margin-right: 10px !important; } .msg { padding: 10px; margin: 10px; }</style> </head> <body><div id="holder"><small style="float:" left;="" font-size:="" 100%;=""><strong>Username - 19:26:34</strong></small><br><div class="msg" center="">Beszélgetés elindítva.</div> <div style="clear:" both;=""></div></div></body></html> Edit: Somehow I would need to add a new apostrophe into my executeBrowserJavascript (like this: <div class='msg center'> , but I have used both of the available characters. (', ") Edit 2: If I manually edit the code in the CEF developer window, it works perfectly, so I am 1000% sure that there is a problem with my executeBrowserJavascript, but I don't know what.
  3. I can't send more codes this is only what I got. If this code was great I could make more code and I would be able to finish the script. The problem is that is does not look right. The only problem I have right now is with the executeBrowserJavascript, that it does not set the class and the style properly. It does not matter how I change my code, the result is still bad for some reason... Here is the full code for chat.html from CEF window: <html> <head> <meta charset="UTF-8"> </head> <style id="theStyle">* { font-size: 95% !important; } .nocolor { font-size: 80% !important; } .right { text-align: right; float: right; background: rgba(124, 197, 118, 0.85); margin-left: 10px !important; } .center { text-align: center; float: center; background: rgba(232, 30, 67, 0.85); margin: 0 auto; } .left { text-align: left; float: left; background: rgba(89, 142, 215, 0.85); margin-right: 10px !important; } .msg { padding: 10px; margin: 10px; }</style> <body><div id="holder"><small style="float:" left;="" font-size:="" 100%;=""><strong>Username - 19:3:7</strong></small><br><div class="msg" center="">Beszélgetés elindítva.</div> <div style="clear:" both;=""></div></div></body></html> Here is the full code that I have right now (if the code was working I could finish the script...) local sx, sy = guiGetScreenSize() local adminPanelOpened = false local PMselected = 0 -- fonts local Roboto = dxCreateFont("files/Roboto.ttf", 15, false, "antialiased") local webBrowser = createBrowser(661, 515, true, false) function math.round(val) return math.ceil(val-0.5) end function openAdminPanel() if not adminPanelOpened then if getElementData(localPlayer, "acc:admin") >=1 then adminPanelOpened = true end else if getElementData(localPlayer, "acc:admin") >=1 then adminPanelOpened = false PMselected = 0 end end end addCommandHandler("apanel", openAdminPanel) function openAdminPanelRender() if adminPanelOpened then dxDrawImage(sx/2-825/2, sy/2-506/2, 661, 515, webBrowser, 0, 0, 0,tocolor(255,255,255),true) end end addEventHandler("onClientRender", getRootElement(), openAdminPanelRender) addEventHandler("onClientBrowserCreated", webBrowser, function() setDevelopmentMode(true, true) toggleBrowserDevTools(webBrowser, true) loadBrowserURL(webBrowser, "http://mta/local/files/chat.html") end ) addEventHandler("onClientBrowserDocumentReady", webBrowser, function () local time = getRealTime() local hourok = time.hour local percek = time.minute local masodpercek = time.second executeBrowserJavascript(webBrowser, "document.getElementById('theStyle').innerHTML = '* { font-size: 95% !important; } .nocolor { font-size: 80% !important; } .right { text-align: right; float: right; background: rgba(124, 197, 118, 0.85); margin-left: 10px !important; } .center { text-align: center; float: center; background: rgba(232, 30, 67, 0.85); margin: 0 auto; } .left { text-align: left; float: left; background: rgba(89, 142, 215, 0.85); margin-right: 10px !important; } .msg { padding: 10px; margin: 10px; }';") executeBrowserJavascript(webBrowser, "document.getElementById('holder').innerHTML = '<small style=float: left; font-size: 100%;><strong>Username - "..hourok..":"..percek..":"..masodpercek.."</strong></small><br/>';") executeBrowserJavascript(webBrowser, "document.getElementById('holder').innerHTML = document.getElementById('holder').innerHTML + '<div class=msg center>Beszélgetés elindítva.</div> <div style=clear: both;></div>'; window.scrollTo(0,document.body.scrollHeight);") end ) Edit: <strong> and <small> are HTML tags, I want to use them in my script. Edit 2: I know HTML and barely JS, but I don't know why my script does not set those tags correctly...
  4. Hey guys. I want your help. I have a new resource that uses CEF browsers. The problem starts here, i want to use executeBrowserJavascript - and the class is not added to the div's. Code: addEventHandler("onClientBrowserDocumentReady", webBrowser, function () executeBrowserJavascript(webBrowser, "document.getElementById('holder').innerHTML = '<small style=float: left; font-size: 100%;><strong></strong></small><br/>';") executeBrowserJavascript(webBrowser, "document.getElementById('holder').innerHTML = document.getElementById('holder').innerHTML + '<div class=msg center>Beszélgetés elindítva.</div> <div style=clear: both;></div>'; window.scrollTo(0,document.body.scrollHeight);") end ) Code on CEF dev tools: <div id="holder"><small style="float:" left;="" font-size:="" 100%;=""><strong></strong></small><br><div class="msg" center="">Beszélgetés elindítva.</div> <div style="clear:" both;=""></div></div>
  5. So... Here is the code. I call this function once a new player joins into the party. This is client side: function getBlipAttachedTo( thePlayer ) local blips = getElementsByType( "blip" ) for k, theBlip in ipairs( blips ) do if getElementAttachedTo( theBlip ) == thePlayer then return theBlip end end return false end function belepveAGecibe() for k,v in pairs(getElementsByType("player")) do if (getElementData(v, "inPartyOf") == getElementData(localPlayer, "inPartyOf")) then if v ~= localPlayer then if not getBlipAttachedTo(v) then x, y, z = getElementPosition(v) blipToPartyMembers = createBlipAttachedTo(v, 35) setElementData(blipToPartyMembers, 'tooltipText', getPlayerName(v)) end end end end end addEvent("belepveNagyon",true) addEventHandler("belepveNagyon",getRootElement(), belepveAGecibe) And i use this on server side: addEventHandler("onPlayerQuit",getRootElement(), function() local blips = getBlipsAttachedTo(source) if blips then for i,theBlip in ipairs(blips) do destroyElement(theBlip) end end end ) function getBlipsAttachedTo( thePlayer ) local attached = {} local blips = getAttachedElements(thePlayer) for k, theBlip in ipairs( blips ) do if isElement(theBlip) and getElementType(theBlip) == 'blip' then table.insert(attached,theBlip) end end return attached end Edit: Got it to work using this solution: addEventHandler("onClientPlayerQuit",getRootElement(), function() if getBlipAttachedTo(source) then destroyElement(blipToPartyMembers) end end )
  6. Thanks for the code, but... somehow it still does not work... i tried putting this into a different resource but it still does not get rid of any blips, and it does not output any errors to debugscript
  7. is this for client or for server or both? i tried it on the server side and it did not work, but it didn't give any errors... strange
  8. Hi guys. I have some trouble. I want to get rid of any blips attached to a player, here is the code: addEventHandler("onPlayerQuit",getRootElement(), function() local blip = getBlipAttachedTo(source) if blip then destroyElement(blip) end end ) function getBlipAttachedTo( thePlayer ) local blips = getElementsByType( "blip" ) for k, theBlip in ipairs( blips ) do if getElementAttachedTo( theBlip ) == thePlayer then return theBlip end end return false end What causes the problem? Please help me.
  9. Got it to work, thread can be closed. The problem was, that I was using a triggerServerEvent function in the "onClientRender" event, and every time the client rendered, the friend list got loaded: triggerServerEvent("loadFriends",localPlayer,localPlayer, getElementData(localPlayer, "acc:id"))
  10. Hey guys. I have a script where I want to draw text inside a "for" loop, and every row after the first one will vibrate. Have a look: Here is the code for this tab (only this tab vibrates): dxDrawText("#ffffffBarátok", sx/2-825/2+300, sy/2-410/2,sx/2-825/2+530, sy/2-410/2 ,tocolor(69,182,254,255), 0.9, RobotoLSized, "center", "center", false, false, false, true) triggerServerEvent("loadFriends",localPlayer,localPlayer, getElementData(localPlayer, "acc:id")) counter = getElementData(localPlayer, "friendCount") if hasElementData(localPlayer, "friendCount") then if (getElementData(localPlayer, "friendCount") > scrollData and counter < maxShow) then for i=1, counter do friendOG = tostring(getElementData(localPlayer, "friends"..i)) friendLegit = exports.rob_core:findPlayer(localPlayer, friendOG) dxDrawRectangle(sx/2-825/2,sy/2-515/2+(i*65), 825, 40, tocolor(0,0,0,220)) if friendLegit then dxDrawText(getPlayerName(friendLegit) .. " (ID: #45b6fe" .. getElementData(friendLegit, "playerid") .. "#ffffff)", sx/2-825/2+5+22,sy/2-515/2+(i*65)+2, 0, sy/2-515/2+(i*65)+2+36, tocolor(255,255,255,255), 1, Roboto, "left", "center",false,false,false,true) else if not (getElementData(localPlayer, "friendName"..i) == false) then dxDrawText(tostring(getElementData(localPlayer, "friendName"..i)), sx/2-825/2+5+22,sy/2-515/2+(i*65)+2, 0, sy/2-515/2+(i*65)+2+36, tocolor(255,255,255,255), 1, Roboto, "left", "center",false,false,false,true) end end if tonumber(getElementData(localPlayer, "friendOnline"..i) == 1) then isHeOnline = "igen" else isHeOnline = "nem" end if not (getElementData(localPlayer, "friendOnline"..i) == false) then dxDrawText("Online: #45b6fe"..tostring(isHeOnline), sx/2-825/2+5+41+120,sy/2-515/2+(i*65)+2, 0, sy/2-515/2+(i*65)+2+36, tocolor(255,255,255,255), 1, Roboto, "left", "center",false,false,false,true) end if not (getElementData(localPlayer, "friendLastLogin"..i) == false) then dxDrawText("Legutóbb online: #45b6fe" .. tostring(getElementData(localPlayer, "friendLastLogin"..i)), sx/2-825/2+5+41+225,sy/2-515/2+(i*65)+2, 0, sy/2-515/2+(i*65)+2+36, tocolor(255,255,255,255), 1, Roboto, "left", "center",false,false,false,true) end if not (getElementData(localPlayer, "friendLastLogin"..i) == false) then if isInSlot(sx/2+330, sy/2-515/2+(i*65)+7, 65,25) then dxDrawRectangle(sx/2+330, sy/2-515/2+(i*65)+7, 65,25, tocolor(215, 89, 89, 200)) else dxDrawRectangle(sx/2+330, sy/2-515/2+(i*65)+7, 65,25, tocolor(215, 89, 89, 150)) end dxDrawText("Törlés", sx/2+330, sy/2-515/2+(i*65)+7, sx/2+330+65, sy/2-515/2+(i*65)+7+25, tocolor(0,0,0,200), 1, Roboto, "center", "center") end if not (getElementData(localPlayer, "friendLastLogin"..i) == false) then if isInSlot(sx/2+250, sy/2-515/2+(i*65)+7, 65,25) then dxDrawRectangle(sx/2+250, sy/2-515/2+(i*65)+7, 65,25, tocolor(69,182,254, 200)) else dxDrawRectangle(sx/2+250, sy/2-515/2+(i*65)+7, 65,25, tocolor(69,182,254, 150)) end dxDrawText("Meghívás", sx/2+250, sy/2-515/2+(i*65)+7, sx/2+250+65, sy/2-515/2+(i*65)+7+25, tocolor(0,0,0,200), 1, Roboto, "center", "center") end end end end if isInSlot(sx/2-830/2, sy/2+470/2, 830,25) then dxDrawRectangle(sx/2-830/2, sy/2+470/2, 830,25, tocolor(69, 182, 254, 200)) else dxDrawRectangle(sx/2-830/2, sy/2+470/2, 830,25, tocolor(69, 182, 254, 150)) end dxDrawText("Új barát hozzáadása", sx/2+1/2, sy/2+500/2,sx/2+1/2, sy/2+500/2, tocolor(0,0,0,200), 1, Roboto, "center", "center") Please, if you can, help me.
  11. There was no problems with this script... function playMySound() local x, y, z = getElementPosition(localPlayer) local sound = playSound3D ("horn.wav", x, y, z) end function stopMySound() local soundoff = stopSound(sound) end function bindTheKeys() unbindKey("h") bindKey("h", "down", playMySound) bindKey("h", "up", stopMySound) end addEventHandler("onClientResourceStart", resourceRoot, bindTheKeys) You just missed the EventHandler.
×
×
  • Create New...