Jump to content

Hugos

Members
  • Posts

    172
  • Joined

  • Last visited

Posts posted by Hugos

  1. function ...()
    	local username = getPlayerName(source)
    	local qh_account = dbQuery(db, "SELECT * FROM accounts WHERE username=? LIMIT 1", username)
    	local result_account = dbPoll(qh_account, -1)[1]
    	if result_account then
    	local serial = result_account.serial --serial in DB
        getPlayerSerial(source)
    end
      

    I have a feature where I get a serial number from the database (6 line) and recognize the player 's serial number at the moment (7 line). I need to compare whether the serial number is recorded in the database or if there is an empty string. If the line is empty - you need to add data (which I received in the 7 line), and if the serial number has already been recorded, I need to break it with the player number (if the number differs - output the text to the console
    How to make it?

  2. On 05/09/2019 at 09:04, Hugos said:

    Hey. I need your help!
    I have this rectangle:

    
    addEventHandler("onClientRender", root, windows)
    -------------------------------------------------
    function windows()
    	dxDrawRectangle(0, y-y/7.5, y/1.6, y/15, tocolor(0, 0, 0), true)
    end
    

    How do I animate it with "interpolateBetween" so that it "leaves" (strEasingType - "Line") from the left corner?
    Tell me how to WRITE correctly "interpolateBetween"! PLEASE)

    And how can you return the rectangle to the starting position (you need to make a reverse animation)?

  3. On 05/09/2019 at 17:39, Ceeser said:
    
    local iStartTick = 0 -- Needs to get set using getTickCount() when you want to start your animation
    local iAnimDuration = 2000 -- The animation takes 2s to perform
    
    local x1 = 100 -- Left START position of your rectangle
    local y1 = 100 -- Top START position of your rectangle
    local x2 = 500 -- Left END position
    local y2 = 500 -- Top END position
    
    function render()
        local iProgress = (getTickCount() - iStartTick) / iAnimDuration -- Get the difference between now and startTick and divide by wanted duration to get the progress of your animation
        local x, y = interpolateBetween(x1, y1, 0, x2, y2, 0, iProgress, "Linear")
      
        dxDrawRectangle(x, y, 100, 100, tocolor(255, 255, 255, 255))
      
        if (iProgress >= 1) then -- If the animation is done stop the animation + rendering
        	iStartTick = 0;
        	removeEventHandler("onClientRender", root, render)
        end
    end
    
    function startAnimation() -- Call this function when you want to start your animation
        iStartTick = getTickCount()
        
        addEventHandler("onClientRender", root, render)
    end
    

    This will start rendering and animation always when you call startAnimation()
    Hope with this you can do everything you want.

    Thanks!

  4. Hey. I need your help!
    I have this rectangle:

    addEventHandler("onClientRender", root, windows)
    -------------------------------------------------
    function windows()
    	dxDrawRectangle(0, y-y/7.5, y/1.6, y/15, tocolor(0, 0, 0), true)
    end

    How do I animate it with "interpolateBetween" so that it "leaves" (strEasingType - "Line") from the left corner?
    Tell me how to WRITE correctly "interpolateBetween"! PLEASE)

  5. A question arose... is it possible to write a function in the resource that would create a new log file, set a specific name for it? (well, to be able to record this log some events)

  6. 59 minutes ago, Ceeser said:
    
    function trigger()
      label = guiCreateLabel(...)
      addEventHandler("onClientGUIClick", label, function_label)
    end
    
    -- and now call the function like this:
    
    trigger()
    

    Idk if thats what you want but if so.. Instead of the triggerEvent just call the function itself
    Also you are talking about trigger in your post but in the code snipped you have "tigger" everywhere

    The name is just for example, but I need to REMOVE the trigger

  7. I have such trigger:

    triggerEvent("tigger", root)
    
    
    addEvent("tigger", true)
    function tigger()
      label = guiCreateLabel(...)
      addEventHandler("onClientGUIClick", label, function_label)
    end
    addEventHandler("tigger", root, tigger)

    How to me to remove this trigger?

  8. It is possible to make still so...

    edit =  guiCreateEdit(x, y, width, heiht, "you text" ) --We set the name of a variable
    str = string.gsub(guiGetText(edit), " ", "") --Get text and replace spaces
    guiSetText(edit, str) --Let's replace with the ready text

    P.S: string.gsub (<s>, <Search pattern>, <Replacement template>, [n])

    • S is a string.
    • Search pattern - what to search for or regular expression.
    • Replacement template - what to replace.
    • N - how many times can a replacement be made at most.
  9. On 02/09/2019 at 14:29, sing said:

    I want to enable not fighting each other when I play on LAN mode with my friend, cuz it will be more fun if we not fight each other and go somewhere together. Thanks in advance for commenting

    Such a system can be implemented

  10. I have a line with "money," this knowledge I frame in "dxDrawText." (For example, You Money: $156,000). I need to change the string (Lua) to get a number separated by a dot, i.e. "156.000," instead of "156000." I need to add dots every 3 digits starting at the end, but I don 't know how to do it properly?

  11. 10 минут назад, сказал Гузек:

    Witaj, proszę zmień mój numer seryjny MTA

    Mój numer seryjny to:D4186BA394473AE52F03B8788A754684

    Numery seryjne się nie zmieniają.

  12. I have a function where I get text from "guiCreateEdit," as well as "triggerServerEvent," I need to move my text to the server part. How do I do that?

    function go(button)
        if button == "left" then
        	guiGetText(pin)
        	triggerServerEvent("check", resourceRoot)
        end
    end

     

  13. All right, I already figured it out. Everything is much easier...

    pin = ("" ..string.gsub(guiGetText(PIN), "%D", "").. "")
    guiSetText(PIN, pin)

    string.gsub - we replace in line "%D" on "" , and all.

    • guiGetText(PIN) - My line with we enter the text;
    • "%D" - Any letter or symbol other than digit;
    • "" - emptiness;
    • Like 1
  14. 11 hours ago, majqq said:

    I doubt, that is possible. If it would be possible, then probably such feature would exist since long times. Afaik without modifying GTA SA nothing could be done.

    In SA-MP, 0.3.DL realized the ability to add their skins/models without replacement. But we still speak for MTA)

  15. I have a "guiCreateEdit," I need to prohibit the user from entering any characters except numbers. And I need to bring them out using "dxDrawText," but replacing them with "*" (asterisk). How do I do that?

    addEvent("edit", true)
    function editbox()
    	PIN = guiCreateEdit(0, 0, 0, 0, "", false) 
    end
    addEventHandler("edit", resourceRoot, edit)
    
    function pin()
    	dxDrawText(guiGetText(PIN), 0, 0, 100, 100, tocolor(0, 0, 0), 1, Font, "center", "center", true, true, true)
    end

    (It is string.gsub necessary to use? )

×
×
  • Create New...