Jump to content

albers14

Members
  • Posts

    73
  • Joined

  • Last visited

Posts posted by albers14

  1.   
      
    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?

  2. SQLmarker = executeSQLQuery("SELECT rowid, * FROM spawncar") --Select the rowid, and all other columns 
    for i,v in ipairs(SQLmarker) do 
        v["rowid"] 
        v.rowid 
        -- Both work, choose any. 
    end  
    

    If this is the case then I fucking love you (no homo) lol

    gonna post with a edit tomorrow :)

  3. Hey guys,

    I am wondering how I retrieve the row id in a SQLite table?

    My script looks like this

      
    function createDB() 
    executeSQLQuery("CREATE TABLE IF NOT EXISTS spawncar(id INT, x TEXT, y TEXT, z TEXT, xr TEXT, yr TEXT, zr TEXT, r INT, g INT, b INT, r2 INT, g2 INT, b2 INT, nitro TEXT, lockType TEXT, lockedTo TEXT)") 
    createMarkers() 
    end 
    addEventHandler("onResourceStart", resourceRoot, createDB) 
      
    function createMarkers() 
    SQLmarker = executeSQLQuery("SELECT * FROM spawncar") 
    markers = {} 
    for i,v in ipairs(SQLmarker) do 
        local marker = createMarker(v.x,v.y,v.z-1, "cylinder", 2, 255,0,0,150) 
            setElementData(marker,"row",v.rowid) 
     -- At here I wanted to retrieve the data about the rowid and assign the ID to the marker, but how can I do that? 
            setElementData(marker, "carspawner",true) 
            setElementData(marker, "carid", v.id) 
            setElementData(marker, "x",v.x) 
            setElementData(marker, "y",v.y) 
            setElementData(marker, "z",v.z) 
            setElementData(marker, "xr",v.xr) 
            setElementData(marker, "yr",v.yr) 
            setElementData(marker, "zr",v.zr) 
            setElementData(marker, "r",v.r) 
            setElementData(marker, "g",v.g) 
            setElementData(marker, "b",v.b) 
            setElementData(marker, "r2",v.r2) 
            setElementData(marker, "g2",v.g2) 
            setElementData(marker, "b2",v.b2) 
            setElementData(marker, "nitro",v.nitro) 
            setElementData(marker, "lock",v.lockType) 
            setElementData(marker, "lockedTo",v.lockedTo) 
    end 
    end 
      
      
      
    

  4. First of all your from DK?

    Next, there is no ID in MTA. So unless you had somewhere set the ID of the player then you cant do that stuff..

    use getPlayerFromName instead, it finds the player element based on the name.

  5. Hey all I tried to make this script for outputting all the information about all siren points at my vehicle but unsuccesfull

      
    function getSirens(thePlayer) 
    if thePlayer and isPedInVehicle(thePlayer) then 
    sirenData = getVehicleSirens(getPedOccupiedVehicle(thePlayer)) 
    parm = getVehicleSirenParams(getPedOccupiedVehicle(thePlayer)) 
    int = parm.SirenCount 
    for i = 1,int do 
      
    outputChatBox("setVehicleSirens(getPedOccupiedVehicle(thePlayer),"..i..","..tostring(sirenData[i][4])..","..tostring(sirenData[i][5])..","..tostring(sirenData[i][6])..","..tostring(sirenData[i][1])..","..tostring(sirenData[i][2])..","..tostring(sirenData[i][3])..")") 
    end 
    end 
    end 
    addCommandHandler("specs", getSirens) 
      
      
      
      
    

    The outputchatbox 6 last arguments outputs nil where they should give me a number. Any solution? The for i = 1, int do works fine as it outputs the number find :)

  6. Heya all.

    I am going to work abit with dxDraw and thought about the possibility to put a text on a object?

    Which functions should I use and how should I use them? I am not asking for a full code as I want to learn something from it not just have it :)

    Thanks :)

  7. Post the code where the element get created. Else let me explain.

    What I can see is you already got a table with the objects whatever..

    Create a new table called objectOwner, and everytime you create a new object you use the code

      
    objectOwner[theObject] = thePlayer 
      
    

    Which means you are saying the object owner of the theObject, is a player data. The player which created theObject.

    And then you check if the clicked element is owned by thePlayer with,

      
      
    addEvent( 'onDestroyElement',true ) 
    addEventHandler( 'onDestroyElement',root, 
        function( ) 
    if source then 
        if objectOwner[source] == thePlayer then  
            destroyElement( source ) 
        end 
    end 
    ) 
      
      
    

    Should be working but not tested ;)

×
×
  • Create New...