Jump to content

IIYAMA

Moderators
  • Posts

    6,058
  • Joined

  • Last visited

  • Days Won

    208

Everything posted by IIYAMA

  1. This tutorial is about scaling, not about positioning. If you are going to place it in the right + bottom corner, you have to start from that corner, not from the center. textWidth DOES NOT EXIST with the dxDrawText function. This function is making use of a text bounding box, which has a START (x,y) and an END (x,y). In this box you can align the the text: left, right, top, bottom. center(x), center(y). The following bounding box > starts at 0,0 which is the left + top corner and > ends on the right + bottom corner with some offset from the sides. The text is aligned to the right and to the bottom. local offsetFromSides = scaleV * 10 local textEndX = sx - offsetFromSides local textEndY = sy - offsetFromSides dxDrawText( text, 0, 0, textEndX, textEndY, tocolor(255, 255, 255, 255), scaleV*2, "arial", "right", "bottom")
  2. Not really, but in the past I did create an experimental tablet / mobile / desktop version of the game as web app. This is exclusive serverside multiplayer, only local multiplayer. Note: Docs is in Dutch. Download JavaScript
  3. @Sergo86 You should script this most partly serverside. And tell each client the direction of the ball. Synchronisation Server: ball position + direction > streamed to the clients. Client: position of the bars (to block the ball) > streamed to server Physics Server: mathematically collision calculations. Client: same mathematically collision calculations, except it gets overruled by the server in certain events. Like: ball misses bar or game ends. Key component: getTickCount()
  4. @Swagy You can capture the screen with the following function: [input] https://wiki.multitheftauto.com/wiki/DxCreateScreenSource You can also figure out when somebody makes a screenshot: [timing] https://wiki.multitheftauto.com/wiki/BindKey You can get the pixels from that captured moment : [transform] https://wiki.multitheftauto.com/wiki/DxGetTexturePixels Save the image inside of the resource folder: [save] https://wiki.multitheftauto.com/wiki/DxConvertPixels And using XML or JSON to keep track of the saved files. [register]
  5. Removing the addEventHandler does not stop the video. This handler only triggers when the browser is ready to be used. This only happens 1 time, per browser. If you want to stop playing YouTube, you could change the url or destroy the browser.
  6. function getB() loadBrowserURL(source, "https://www.youtube.com/") end local browser function createYouTubeBrowser () if not browser then browser = guiCreateBrowser(0, 0, 1, 300, false, false, true, bbas) end local theBrowser = guiGetBrowser(browser) if source == youbutton then addEventHandler("onClientBrowserCreated", theBrowser,getB) guiSetEnabled ( youbutton, false ) guiSetEnabled ( googlebutton, false ) elseif source == stopbutton then removeEventHandler("onClientBrowserCreated", theBrowser,getB) guiSetEnabled ( youbutton, true ) guiSetEnabled ( googlebutton,true) end end addEventHandler("onClientGUIClick", stopbutton, createYouTubeBrowser) addEventHandler("onClientGUIClick", youbutton, createYouTubeBrowser) Something like that. Problem: You created multiple browsers. Tweak: Reduced event trigger rate, by attaching them to the right elements. @SoManyTears
  7. Hey people, that some how get once again another super annoying pop-up...  ☹️

     

    I just wanted you to know that I kept my promise, project trains V2.0.0  is out with open source.

    It took a little bit longer to clean up the old code, so `soon` was unfortunately not so soon. If you want to edit it, I have to apologies that I didn't clean up all the inconsistency within the code style. But never the less it has tabs and comments ?!

     

     

    I wish you the best of luck in these crazy times!

    1. Show previous comments  3 more
    2. ds1-e

      ds1-e

      @IIYAMA carwars, it's kinda training server based on one of popular DayZ (not casual one - more like madness), mode - could say, most popular in Russia :)

    3. IIYAMA

      IIYAMA

      @majqq Nice! Enjoy developing it!

      It is probably in Russian language I assume?

    4. ds1-e

      ds1-e

      @IIYAMA thank you, but it supports more than just Russian language - English, Polish, French.

  8. You can download 2.0.0 now. See key features on the first page.
  9. Then use a private message with him... leave me out of it. Locked, reason: scripting request
  10. This section is for learning to script, feel free to make use of that. Unfortunately scripting requests are not allowed in this section. Please read the section rules:
  11. @FIY9AL You could also add: function displayCountDown(hh, mm, ss, format, countdownFin) if countdownFin then countdown = setTimer(countdownFin, direction+1000, 1) end Else there the callback function is very static.
  12. The event onClientResourceStart tells the client/player that a resource has been started on his computer. Then you can use triggerServerEvent directly after that to inform the server that a resource has been loaded on a client his computer. By adding these players to a table, you specify which players are loaded: local loadedPlayers = {} loadedPlayers[#loadedPlayers + 1] = player triggerClientEvent ( loadedPlayers, "eventName", resourceRoot) This only matters when an instruction send in the past is relevant momentarily and can't it be predicted without synchronizing with the server. So the instruction is: the server tells a player that a ped has to be muted. But a specific player didn't load his script. So he isn't aware of that instruction. The player loads from this moment his scripts. The following question is: Does this instruction to mute a ped, is relevant for this player? Because the ped isn't muted for him. Based on the reaction on your previous reply, it is a YES. Can this player that didn't receive the instruction, predict the instruction that should have been executed on the ped? A: If all peds have to be muted within the resource. Then yes, you can predict this instruction and disable clientside the voices of all peds of this resource. Note: something similar might have been added to this resource already. addEventHandler("onClientResourceStart", resourceRoot, function () setPedVoice(resourceRoot, "PED_TYPE_DISABLED") -- mute all current peds of this resource. This does not include new created once. end) B: If that is not the case, then I do not have 1,2,3 a solution for you. You need to keep track which peds are muted and which are not.
  13. It occurs when you use triggerClientEvent on a player that isn't finished downloading or loading it's scripts. In most cases it can be ignored. In your case it means that your zombie isn't muted for a specific player. If you want to optimise it, you should keep track of loaded players and only send messages to that segment. And also send a message to new loaded players. It is a time consuming fix, unless it was correctly done from the beginning.
  14. @Adolfram See event open in: https://nodejs.org/en/knowledge/advanced/streams/how-to-use-fs-create-read-stream/ In that example they pipe it when the readable stream is ready.
  15. Yes possible. You can counter that with the second example of this page: https://wiki.multitheftauto.com/wiki/OnElementDataChange In my opinion it is bad practice to save money and items in element data. You can use it for displaying those information of course, but I do not recommend to use it as the basic of a saving system.
  16. You can put the delay on either Node.js or MTA. Not sure what the best solution is. For MTA: setTimer(function () sound = playSound ( url, false, true ) end, 100, 1)
  17. Yup, I just failed to understand that it was for streaming and not fetching on a stream. ? In the past I created a custom html player, which sometimes failed because the meta data (...length of the audio...) wasn't sent quick enough. Which is not the same as your problem, but it could be related. Maybe a little delay could do the trick?
  18. Did you flush the file write? https://wiki.multitheftauto.com/wiki/FileFlush Because it possible that the file hasn't been fully written and that a piece of it is still in your memory. Or are you fully streaming?
  19. Good question. How did you program it so that it waits until it is finished downloading? And did you make sure the file is created after the response and not before?
  20. Interesting solution @Patrick , I am hardly using metatables so I have always trouble to get around the default table logic. btw I am wondering is the rawset function not required to set the value on line 26?
  21. Hey people, how is prison? ?

     

    In 2015 I released a beta version of a resource that created driving trains. But unfortunately I never finished it. So that is why I am making a final update for it, including rewriting and cleaning the old code.

    The this version will be uncompiled, so you can adjust it like you want.

    It will take some more days to finish it, so be patient.

     

    I can send you a pre-version, if you like to try it out before the release. No requirements for a pre-version, just a little bit feedback would be nice. To receive the pre-version, send me a personal message and I will send you the version within 1-3 days.

     

     

    The old topic:

     

  22. I will somewhere this week publish a new version of this resource. Because I wanted to finish it at-least. Uncompiled Better optimised than previous versions. CPU (3,5-3,9 GHz) 4 trains +/- 1.22% usage 40 trains +/- 7.05% usage Overkill Cleaned up a lot of the old code (I wrote this in 2015.. , never the less it is still ugly :C) Added some custom train-cart designs. Fixed all known bugs. Trains won't stop, even in this version. But you can try to make that yourself... If you want to test it out, before I put it on the community, free feel to send me a message. But in return I did like to receive some feedback.
  23. IIYAMA

    (HELP) Nametag

    Locked (For making a script request) and acting like it is not a big deal with a topic bump, after you received the information you needed to know.
  24. Locked reason: double post
×
×
  • Create New...