Jump to content

CEF using the cursor


Recommended Posts

  
  
local sW, sH = guiGetScreenSize() 
  
local browser = createBrowser(sW,sH,false,false) 
  
function renderYt() 
    dxDrawImage(0,0,sW,sH,browser,0,0,0,tocolor(255,255,255,255),true) 
    showCursor(true) 
end 
  
function createIt() 
    loadBrowserURL(source,"https://www.youtube.com/watch?v=RgKAFK5djSk") 
    focusBrowser(browser) 
    addEventHandler("onClientRender", root, renderYt) 
    end 
addEventHandler("onClientBrowserCreated", browser, createIt) 
  
  
addEventHandler("onClientClick", root, 
    function(button, state) 
    if state == "down" then 
        injectBrowserMouseDown(browser, button) 
        outputChatBox("Injected") 
    else 
        injectBrowserMouseUp(browser, button) 
        outputChatBox("InjectedUp") 
    end  
end) 

So that is my code. Seems like it doesnt detect my clicks on the website, but mta detects it fine? (Outputting to chat) Any ideas how to fix this?

Link to comment

**Be sure that you use MTA 1.5

On line 13 at Function "loadBrowserURL" instead of Source put the browser Element

like you did and in line 14 at Function "focusBrowser"

may code not work because of this as i don't see anything else to be wrong

Link to comment
Are you using mta 1.5 nightly?

Because it's under developing, all services maybe not work.

It works fine for me, Check my video

So that is my code. Seems like it doesnt detect my clicks on the website, but mta detects it fine? (Outputting to chat) Any ideas how to fix this?

You didn't inject mouse movement

use the event onClientCursorMove and injectBrowserMouseMove function to do that

anyway try this

local sW, sH = guiGetScreenSize() 
  
local browser = createBrowser(sW,sH,false,false) 
  
function renderYt() 
    dxDrawImage(0,0,sW,sH,browser,0,0,0,tocolor(255,255,255,255),true) 
    showCursor(true) 
end 
  
function createIt() 
    loadBrowserURL(source,"https://www.youtube.com/watch?v=RgKAFK5djSk") 
    focusBrowser(browser) 
    addEventHandler("onClientRender", root, renderYt) 
    end 
addEventHandler("onClientBrowserCreated", browser, createIt) 
  
  
addEventHandler("onClientClick", root, 
    function(button, state) 
    if state == "down" then 
        injectBrowserMouseDown(browser, button) 
        outputChatBox("Injected") 
    else 
        injectBrowserMouseUp(browser, button) 
        outputChatBox("InjectedUp") 
    end 
end) 
addEventHandler ( "onClientCursorMove", root, 
                function (  relativeX , relativeY , absoluteX , absoluteY ) 
                    injectBrowserMouseMove ( browser, absoluteX , absoluteY) 
                end ) 

Edited by Guest
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...