-
Posts
6,088 -
Joined
-
Last visited
-
Days Won
215
Everything posted by IIYAMA
-
Have you used debug lines to debug/verify every part of the call chain?
-
I tested the following code with this compiler and it works. https://onecompiler.com/lua/42wdewngs Are you sure you are not synchronizing the data or exporting it(call/export)? Because in that case interactionFunction becomes nil. PointOfInterest = {} PointOfInterest.__index = PointOfInterest function PointOfInterest:create(x, y, z, interactionRadius, interactionFunction, visibleDistance, interior, dimension, renderOffsetX, renderOffsetY, renderOffsetZ, onFootOnly) if type(x) ~= "number" or type(y) ~= "number" or type(z) ~= "number" then error("Bad argument @ PointOfInterest:create [Expected number at argument 1, 2, 3, got "..type(x)..", "..type(y)..", "..type(z).."]", 2) end if type(interactionFunction) ~= "function" then error("Bad argument @ PointOfInterest:create [Expected function at argument 5, got "..type(interactionFunction).."]", 2) end local poi = {} setmetatable(poi, PointOfInterest) poi.x = x poi.y = y poi.z = z poi.interactionRadius = type(interactionRadius) == "number" and interactionRadius or 1 -- [temp disabled] poi.collision = createColSphere(x, y, z, poi.interactionRadius) -- [temp disabled] poi.collision:setID("poi") -- Set the ID to "poi" to identify it as a point of interest poi.interactionFunction = interactionFunction -- [simplified] poi.visibleDistance = type(visibleDistance) == "number" and visibleDistance or 10 poi.interior = type(interior) == "number" and interior or 0 poi.dimension = type(dimension) == "number" and dimension or 0 poi.renderOffsetX = type(renderOffsetX) == "number" and renderOffsetX or 0 poi.renderOffsetY = type(renderOffsetY) == "number" and renderOffsetY or 0 poi.renderOffsetZ = type(renderOffsetZ) == "number" and renderOffsetZ or 0 poi.onFootOnly = (type(onFootOnly) == "boolean" and onFootOnly) or false -- [temp disabled] TBL_POIS[poi.collision] = poi return poi end function testfunc() print('You are near the point of interest!') return true end local test = PointOfInterest:create(195.00665283203, -141.83079528809, 1.5858917236328, 1, testfunc, 10, 0, 0, 0, 0, 1, true) print(test.interactionFunction()) Output: You are near the point of interest! true
-
That should be fine. You can make a bug report here. As a temporary solution you can stop the rendering process: https://wiki.multitheftauto.com/wiki/SetBrowserRenderingPaused (Note: This does not free up the memory.)
-
How do you close the browser? (as in code)
-
Correct! Please mind that the primary language of this section is English. It is fine to add additional translations for clarification.
-
And what does this output? console.log("Parsed leaderboard data:", leaderboardStats, typeof(leaderboardStats));
-
And if you do not modify the JSON? (and use backticks) local testJSON = toJSON(leaderboardData) if isElement(initBrowser) then local script = string.format("populateLeaderboard(`%s`);", testJSON) outputChatBox("SCRIPT : " ..script) executeBrowserJavascript(theBrowser, script) end const leaderboardStats = JSON.parse(leaderboardDataJSON); console.log("Parsed leaderboard data:", leaderboardStats);
-
Additional context: Serverside is code executed on the server. The application all players are connected to. Clientside is code executed on each client/player his game. There are as many clientsides as there are players in the server. They all run a copy of all clientside scripts. Each player downloads the clientside code from the server. When a player joins the server, in most cases the copy of the code will only run until the download is finished. (with an exception if priority is given to a specific resource) Shared is code executed On the server And a copy of the code is executed on each client / player his game Nothing is shared between them, except for running the same copy of the code.
-
It looks like you got some unparsed JSON in your JSON result. console.log(typeof(leaderboardStats)) // If type is object: const result = JSON.parse(leaderboardStats[0]) // or if the type is a string: const result = JSON.parse(leaderboardStats) To make things a bit easier, use back-ticks so you do not have to escape your own JSON: local script = string.format("populateLeaderboard(`%s`);", escapedTestJSON)
-
Which debug lines are being called in the browser? (if any) Use the following function to open the dev tools and check which ones are visible: https://wiki.multitheftauto.com/wiki/ToggleBrowserDevTools
-
Are you sure those newlines are correct? As far as I can remember the following is considered a newline in Lua: \n Or auto newlines: local test = [[ newline newline newline newline ]] But I can be mistaken, maybe MySQL also accepts your way. Also make sure multi_statements is enabled, see: https://wiki.multitheftauto.com/wiki/DbConnect
-
@Perseus It looks like a latency issue or bullet sync is not enabled. Also, what is your server FPS? The bullets here are behind the player, see screenshots. You could also try to freeze the player with this function: https://wiki.multitheftauto.com/wiki/SetElementFrozen And shoot from the side while running, that way you can verify if it is 1 issue or 2 issues.
-
What if you switch roles and film the one that gets hit? That way you can verify if it is a bug. Also: Double check if bullet sync is active. It is indeed possible to override the bullet/damage system, but lag compensation is very complex and often result in unexpected results.
-
What is the ping of the other player? It is normal to compensate your aim for latency, when the damage is registered clientside. You should aim at the location where the player is moving to. The higher the ping. the more you need to compensate. If you shoot a player in the back/front, latency matters less, it just delays the inevitable. Having 0 recoil makes the latency issue even worse, because the spread normally makes sure that at least some bullets hit. I recommend to put the recoil not to 0. It is fine to put it very low, but if you put it to 0, some calculations might be miscalculated. Increasing the interval does reduce some of the extra latency. To be specific from 100 > 50 could potential update the player position 50ms faster. But that is only the case with a stable internet connection. In case of an unstable internet connection, it might even increase latency when the network is being blocked by too many unreceived position updates.
-
This function is able to mimic that behaviour you just mentioned. Just be aware. It might be worthed to look in to it and test if it has any impact if any of those are restarted. Also double check if the remote access is disabled for all of them. (2e argument of addEvent)
-
Are you using addDebugHook function somewhere in your resources? Also the addEvent function should also be called at the resource where addEventHandler is being used.
-
If: clientside only without local files It might be possible with: fetchRemote + requestBrowserDomains But only very small images because of JSON limitations. fetchRemote only accepts JSON format. I do not recommend this method unless it is only for small avatars. You also need an webserver/host where you save the images in JSON format and send it to the client.
-
There is not really a non expensive way except for the debughook, which is CPU expensive to use. From my perspective, the more complex you make this threshold mechanism, the faster your server will be downed. For sensitive events attached to for example a database, you want to have some kind of firewall, for example: checkPassiveTimer (utility with clean-up)
-
if x and y and z and world and dimension and rotation then local player = client -- < HERE setElementData(player, "player.activeMarker", false) Make `player` a local variable. Else all players will share the variable `player` for the (delayed) timer functions. You can also pass the predefined `client` variable like this: setTimer(function (player) end, 1500, 1, client)
- 1 reply
-
- 1
-
-
When saving the userdata of an element inside of a variable and delete the element afterwards, it's userdata type becomes generic/something else. This might also be the case for accounts. https://wiki.multitheftauto.com/wiki/GetUserdataType
-
Purrrrfect!
-
It depends on the amount of players and the server. 10 players should be fine. More players? It is fine to save the the current km's inside of the memory. But writing it immediately to the database will definitely be a waste of performance, that can be spend else were.
-
For example trigger every 10 seconds a latent event. Those last <10 seconds do not really matter. You want to balance performance and accuracy. To reduce server load and less db crash exploit able: Save it inside of the memory and write every 10/X minutes updates to the database. + onResourceStop
-
Multiple reasons onClientPlayerQuit is for remote players only. (Other players than yourself) Currently when another player leaves, the stats of all other players are being saved, except yours. When you quit the game, the client code on your system will stop. Not sure if there is enough time to send data on onClientResourceStop + resourceRoot. But I wouldn't rely on it. Using a timer to delay sending data, makes things really impossible. Other issues: onClientPlayerWasted should be attached to the localPlayer, not the root element. Else it also triggers for remote players. addEventHandler("onClientPlayerWasted", localPlayer, onPlayerWasted) The source from remote events can't be trusted, use the predefined variable client instead: if not exports.login:isPlayerLoggedIn(client) then return end exports.login:updatePlayerStat(client, "stat", "stat", data)
-
No, not through config files. Only resources might be able to do this.