Jump to content

IIYAMA

Moderators
  • Posts

    6,097
  • Joined

  • Last visited

  • Days Won

    218

Everything posted by IIYAMA

  1. IIYAMA

    Question

    You are hosting it at your server, but you are trying to access it with an url for local hosting. For server hosting https://wiki.multitheftauto.com/wiki/Resource_Web_Access
  2. IIYAMA

    Question

    Did you send over the file to clientside? <file /> A client-side file. Generally these are images, .txd, .col, .dff or .xml files. They'll be downloaded by clients when the resources is started (or on join) src: client-side file name (can be path too eg. "images/image.png") download: Whether or not to be sent to the client automatically (optional). Default is "true". Using "false" will mean they are not sent on resource start but could later be used by downloadFile. Or did you let the server host it? <html /> src: The filename for the HTTP file (can be a path) default: The html file is one that is shown by default when visiting /resourceName/ on the server. Only one html can be default, the rest are ignored. (true/false) raw: The html file is not parsed by the Lua interpreter and is treated as binary data. Must be used for binary files (images mainly) (true/false) https://wiki.multitheftauto.com/wiki/Meta.xml You must first do one of those two, to make it accessible.
  3. Concat with iprint like this: iprint( "qh ", qh, ", result: ", result ) @Ziemo
  4. @alexaxel705 English only in this section. 2 languages with the same text and one of them English? Sure, that is acceptable.
  5. @[M]Province Formatting: outputChatBox("help yourself please")
  6. Yes, when that number exceeds around 20. 20 = overall 2 updates per second. Which is not good, because it is not only 2 updates, it is: 2 X playerCount = impact on the server network. 100 = bad 300 = really bad 1000 = I am not joining your server for sure
  7. @[M]Province > https://forum.multitheftauto.com/forum/117-скриптинг/ Moved topic.
  8. local eventList = {} setTimer( function () if next(eventList) then outputDebugString(inspect(eventList)) eventList = {} end end, 10000, 0 ) addDebugHook( "preEvent", function ( sourceResource, eventName, eventSource, eventClient, luaFilename, luaLineNumber, ... ) local args = { ... } local i = "resource: " .. (sourceResource and getResourceName(sourceResource) or "[unkown] ") .. ", key: " .. tostring(args[1]) .. ", file: " .. tostring(luaFilename) .. ", line-number: " .. tostring(luaLineNumber) eventList[i] = (eventList[i] and eventList[i] + 1) or 1 end, {"onElementDataChange"} ) If this code works, then you can start fixing things. @juaosilv
  9. Why? ? The error was only about 1 line of code.
  10. ["nil/onElementDataChange/elem:vehicle[Police LV]0x11e5"] = 389, ["nil/onElementDataChange/elem:vehicle[Towtruck]0x123a"] = 400, ["nil/onElementDataChange/elem:vehicle[Hustler]0x11e0"] = 310, ["nil/onElementDataChange/elem:vehicle[Police LV]0x11e5"] = 524, ["nil/onElementDataChange/elem:vehicle[Towtruck]0x123a"] = 317, ["nil/onElementDataChange/elem:vehicle[Police LV]0x11e5"] = 956, It looks like it is related to vehicles. Maybe a fuel resource? (Maybe stop that resource and see if it makes any difference) I am currently very busy, so will help later further today.
  11. @Maloi2k Use it serverside. You can't remove players from vehicles on clientside with that function.
  12. To be honest I have no idea. I more or less just do some experiments and see what will happens. Including observing the context and possible situations. But not reading the source code, yes, shame on me. (Verification is not possible to implement in MTA, as that would mean that it would create de-sync or more network usage.) That conclusion is just based on conditional reasoning, which is also a bad habit of mine. Every message counts! if getElementData(root, ":O") ~= true then setElementData(root, ":O", true) end Would this wrapper make people think more about what it means to enable synchronize argument? Or creating more confusing? (lots of old resources will break after applying this...) do local setElementData_ = setElementData function setElementData(element, key, value, synchronize) if synchronize == nil then synchronize = false end return setElementData_(element, key, value, synchronize) end end Old syntax: bool setElementData ( element theElement, string key, var value [, bool synchronize = true ] ) New syntax: bool setElementData ( element theElement, string key, var value [, bool synchronize = false ] ) ohhh, stp t do local setElementData_ = setElementData function setElementData(element, key, value, synchronize) if synchronize == nil then synchronize = false end return getElementData(element, key) ~= value and setElementData_(element, key, value, synchronize) or false end end If we want to get rid of this whole issue: -- clientside setElementDataStreamEnabled(element, state) -- true < receiving elementdata updates from the server for this element. But it might be too late for applying something as big as that, in this stage of the development.
  13. remove the player from the vehicle first. https://wiki.multitheftauto.com/wiki/RemovePedFromVehicle
  14. I can't remembered which thing was responsible for the damage. But the way you describe it, it doesn't sounds too bad. Yes, faking will make the game feel more smoother, especially when we are talking about slow updates. But it will remain an trial-and-error case, as you will have to test it with your users. There are always some unpredictable situations which you didn't think of during your development. Did I answer all your questions? Or did I miss anything?
  15. Both can be used. if type(value) == "number" then end Just tonumber is more forgiving, as you can also accept strings by converting them to numbers. local value = "123" value = tonumber(value) if value then end It just depends how forgiving you want to be. Do not do this: (2 function calls) if tonumber(c_buffer) and tonumber(c_buffer) >= 0 then end But do this: (1 function call) c_buffer = tonumber(c_buffer) if c_buffer and c_buffer >= 0 then end If you can reduce function calls, by just writing it a bit different without messing with the programming flow, you should take it.
  16. Also if you solve this issue, your bandwidth should technically go up:
  17. ? Afk you do not have to modify anything. Copy > past > run
  18. No the one from mrtasty his code.
  19. Can you show me the results?
  20. At first yes you would expect that. But there is one thing that isn't taken in account. If one of the other clients does this: setElementData(root, ":O", false, false) In that case, even if the value doesn't change, the value of this specific client must be updated. With other words it does not matter if the value is the same. All clients their value must be forced to set to the last known value. I don't know if the event is fired or not. But it is just as bad for the network.
  21. The event DNL:Reparar didn't trigger that much. Are you sure this is the code that called the setElementData so much? It is about the execution quantity after all. Make sure to run @MrTasty his code to figure out if where it is actually located.
  22. @dener189 It looks like the fuel system has changed the value to a string. At least not within the code you are currently showing. local fuel = tonumber(getElementData(v, "fuel")) or math.random(10,25) Oh and btw, using this code will ruin your network. So use with caution. You do not want this to happen: So, my recommendation: if getElementData(v, "fuel") ~= fuel then setElementData(v, "fuel", fuel) end
  23. I know this is it because: Most people do not know that synchronize is enabled by default. bool setElementData ( element theElement, string key, var value [, bool synchronize = true ] ) When the synchronize argument is enabled, each function call represents data that is transferring between all clients and the server. And your server said: Those are network messages. Isn't a coincidence? And if I were guessing what so much messages is producing, then this code would look a bit like this situation: addEventHandler("onClientRender", root, function () setElementData(root, ":O", true) end)
  24. Add some debug lines to your code and debug it, else you will get nowhere. And we will not be able to help you... You don't know how to do that? There is a tutorial just for that.
  25. local container = createElement("bots") function spawnBot(...) local bot = exports.slothbot:spawnBot(...) setElementParent(bot, container) end addEventHandler ( "onResourceStart", getResourceRootElement(), function () spawnBot(4845.0258789063, -1713.5711669922, 59.668750762939, 0, 108, 0, 0, teamLV, 31, "guarding", true) end) addEventHandler( "onBotWasted", container, function() setTimer( spawnBot, 5000, 1 , 4845.0258789063, -1713.5711669922, 59.668750762939, 0, 108, 0, 0, teamLV, 31, "guarding", true ) end ) Something like that. @bencskrisz
×
×
  • Create New...