Jump to content

botder

MTA Team
  • Posts

    524
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by botder

  1. botder

    Coroutines

    I wrapped the coroutine with a second coroutine and an infinite loop. You can now resume 'dead' coroutines. You have to use createCoroutine instead of coroutine.wrap function createCoroutine(callback) return coroutine.wrap( function () while true do local ct = coroutine.create(callback) repeat coroutine.resume(ct) coroutine.yield() until coroutine.status(ct) == "dead" end end ) end
  2. botder

    Coroutines

    Basically does a coroutine allow you to make a pause in a function and continue it later. You could for example create objects in a coroutine, yield and then delete them after the yield instantly. When you run that coroutine it will create the objects and then halt. Whenever you run that function again it will delete the objects. simpleCoroutine = coroutine.wrap( function () local objects = {} for i = 1, 25 do objects[#objects + 1] = createObject(1234, 0.0, 0.0, 0.0) or nil end coroutine.yield() for index, object in pairs(objects) do if isElement(object) then destroyElement(object) end end objects = nil end ) addEventHandler("onResourceStart", resourceRoot, simpleCoroutine) addEventHandler("onResourceStop", resourceRoot, simpleCoroutine)
  3. Edit the race resource. Should be the race_client.lua file.
  4. You can abuse Mapname for that purpose
  5. Try to use math.floor for the x/y position
  6. Use dxCreateScreenSource and then draw it. EDIT by mod (its a much viewed topic for this question): For the record, also possible with DxDrawImage and then its arg postGUI; set it TRUE For example: dxDrawImage ( 0, 0, x, y, "img.jpg", 0, 0, 0, _, true); hides the watermark.
  7. function exchangeOption1() local playerCoins = tonumber(getPlayerCoins(client)) if (playerCoins > 99) then givePlayerMoney(client, 1) takePlayerCoins(client, 100) else outputChatBox("You don't have enough coins!", client, 255, 255, 0) end end Use the hidden variable client
  8. botder

    [Wiki] OOP Basis

    Well done. By the way, your backpack example will have endless slots. (and it looks like a short version of mine example in one thread)
  9. Try to find out the texture with this resource: https://wiki.multitheftauto.com/wiki/Sh ... ture_names You can then replace the texture for specific elements (e. g. players) with the parameter targetElement https://wiki.multitheftauto.com/wiki/En ... rldTexture
  10. https://forum.multitheftauto.com/viewtopic.php?p=721951#p721951
  11. Do you want to lay the image .png on the texture in MTA or move the original one and place it next to it?
  12. I would appreciate it when you add a VirusTotal scan report to your file. By the way, nice register-year there.
  13. Hardcore way: Learn C++ and socket programming. Then try to have wide knowledge about the MTA client code and finally make a ghost client, which doesn't start MTA or GTA, but simulates all the traffic impulses between client and server.
  14. You probably won't understand it as a newbie in scripting, but: Delete that part, which shows/hides the freeroam window clientside and make a command bind serverside to control the permission (isOjbectInACLGroup) there and to send a response to a client to either show or hide the window.
  15. Do you want to fuse 2 pictures together? Make a render target big enough to fit the images. Get the pixels (result) with dxGetTexturePixels and convert them to a PNG with dxConvertPixels or use the render target to render both images at once. You can also load an image as texture with the dxCreateTexture function and then also draw the image with the texture.
  16. botder

    Sql table

    You should learn the SQL language and then come back to Lua. Learn also about SQL-Injections. http://www.w3schools.com/sql/
  17. botder

    Sql table

    As a beginner you shouldn't begin with SQL queries and you might try easier things.
  18. The resource only sends the meta.xml setting to each started client and then the clients use that URL to access the extern http server.
  19. botder

    I need help

    And what is the problem? I think you mean the download, when the players joins, right?
  20. You don't even know some basic Lua functions and try to make a relative complex scoreboard? tonumber
  21. You can actually use the resourceRoot to pass the data to each player. setElementData(resourceRoot, "info", { a = "yes", position = {200.5, 1205.2, -2} }) If you have to send data to a specific player, then you have to first send a signal clientside, that the client resource has started and then send the data back to the player triggerLatentClientEvent(player, "eventName", resourceRoot, { somedata = true })
  22. NGVehicles is either missing or not running.
  23. Did you just copy some resources and want us to make it compatible with your server? Anyway, that script has no problems. It's the data input it gets from a resource, which you didn't copy and doesn't exist.
×
×
  • Create New...