-
Posts
6,058 -
Joined
-
Last visited
-
Days Won
208
Everything posted by IIYAMA
-
You can also cancel the object-break of the current resource. -- clientside addEventHandler("onClientObjectBreak", resourceRoot, -- resourceRoot so that it only triggers for elements of the same resource function() cancelEvent() setObjectBreakable ( source, false ) -- optional end ) Or make use of a propagation call for all elements of the whole resource: -- clientside (important for this method here is that you create the elements on serverside without delay > not on onResourceStart) addEventHandler("onClientResourceStart", resourceRoot, function () setObjectBreakable ( source, false ) end, false) Options enough.
-
The xml object model (or a custom implementation) is saved inside of the memory. XML is fast for modifying specific nodes because of the model. When you run out of memory because the file is too big, it is normally for the server to use storage as memory (swap). Which is slow memory. But I am not sure if that is your problem, but it is a possibility. Read more about xml object model here: https://docs.microsoft.com/en-us/previous-versions/windows/desktop/ms759093(v=vs.85) It is very important to unload large xml files. And never use it for data that keeps growing like logs.
-
I have added a test resource for inspiration. Enjoy!
-
I have added a server time sync resource to the community. Useful for scripters that want to play with (infinity) animations. Enjoy and best wishes!
-
Server Time Sync This resource is used to sync server timestamp (in Milliseconds) to all clients. It is for scripters and resources that may use it in the future. The resource itself is not very complicated at it's core, but it can be incredible useful for (infinity) animations. For example to let many trains drive around the map with almost no bandwidth required, in that resource is the same concept applied. local timeNow = exports.servertimesync:getServerTime() if timeNow then local currentRotation = ((timeNow % 10000) / 10000) * 360 -- Rotate 0-359 every 10 seconds. end I have added a little test resource. Which you can download below. World location: 0, 0, ~. You can download the resource here. Enjoy your server . The test resource. (requires servertimesync)
-
According to the warning, playerSource is nil. Try this: addEvent("fwheelset",true) function setf ( ) executeCommandHandler ( "fwd", client, "" ) end addEventHandler("fwheelset", root, setf)
-
It does, there is code included for: exports.resourceName1:createLuaTimer("exports.resourceName2:exportedFunction", 3000, 1) <export function="createLuaTimer" type="client"/> But it can be a bit unreliable, since it doesn't check if an resource has been restarted. It will not destroy the timer, you will have to add that yourself.
-
I think it more or less depends on the quantity of timers. As The_GTA mentioned triggerEvent can be very expensive, but if the amount of timers exceed a specific amount, it might become beneficial at some point. But the amount ???. I came with the following concept, which can handle lots of timers and is just as accurate(or better) as a normal timer. Note: Only when your resource(s) use a lot of timers, else it is not beneficial. Feel free to use/modify/inspiration. https://gitlab.com/IIYAMA12/draw-distance/-/blob/master/scripts/timer_c.lua
-
Try this: function scp(thePlayer) local theVeh = getPedOccupiedVehicle(thePlayer) Be aware that this code does not sync the state of the component, it only syncs the adjustment. But it is a good start, keep it up!
-
You will have to communicate that with the server. There is no server variant. It uses more resources than normal as mentioned on the wiki. But not how much is too much. Money given / set functions are probably not used every 1 second, so it should be a big problem to keep it on. (except when your server needs all resource to keep running)
-
yea, that is possible. https://wiki.multitheftauto.com/wiki/OnClientKey Useful for detecting command exploits: https://wiki.multitheftauto.com/wiki/GetBoundKeys https://wiki.multitheftauto.com/wiki/GetKeyBoundToCommand But in mind to respect privacy and how it will impact the user his network. preEvent postEvent preFunction postFunction Timing: pre = before it happens post = after if happens Type of capture: event = hooks in to the event system function = hooks on to the MTA function calls (afaik it only supports MTA functions, at least that is what I make up about the wiki) And you might also want to remove this hook when you figure out the issue, since it is bad for performance. Instead use exports to a single resource and log there.
-
Using the root prefixed variable in your code is a bit tricky. Better not using it. But never the less. Since it is serverside code, it looks like the resources you are using either has an exploitable bug (likely), backdoor (likely) or is missing some security. Don't you keep more money logs? function onPreFunction( sourceResource, functionName, isAllowedByACL, luaFilename, luaLineNumber, ... ) local args = { ... } local resname = sourceResource and getResourceName(sourceResource) outputDebugString( "preFunction" .. " " .. tostring(resname) .. " " .. tostring(functionName) .. " allowed:" .. tostring(isAllowedByACL) .. " file:" .. tostring(luaFilename) .. "(" .. tostring(luaLineNumber) .. ")" .. " numArgs:" .. tostring(#args) .. " args:" .. inspect(args) ) end addDebugHook( "preFunction", onPreFunction, {"setPlayerMoney", "givePlayerMoney"} ) https://wiki.multitheftauto.com/wiki/AddDebugHook (recommended to write the logs to a different file)
-
How did you verify that he actually passed that amount? Modifying screenshots or ingame textures is very easy to do. Make sure you verify it based on serverside data. You said you checked his bank account? What do you consider somebody his bank account? getPlayerMoney / getAccountData / other database ? getAccountData / other database are not restricted to 99,999,999. Also I am not sure if setPlayerMoney is restricted to 99,999,999, it is surely displayed as a negative value, but I am not sure how MTA handles that behinde the scenes (only way of knowing is to test or check the source code).
-
Please read the section guidelines before posting. Section guidlines Topic locked
-
Client (playerName) triggered serverside event
IIYAMA replied to Pickanothername's topic in Scripting
Double post to work around a topic lock.- 1 reply
-
- 1
-
Client (playerName) triggered serverside event
IIYAMA replied to Pickanothername's topic in Scripting
Locked for purposely not being transparent about the source resource.- 1 reply
-
- 1
-
You can use Object Preview to draw it in front of the player. https://community.multitheftauto.com/index.php?p=resources&s=details&id=11836
-
If the object doesn't need collision, you can create it with a lowLOD appearance. https://wiki.multitheftauto.com/wiki/CreateObject Syntax createObject function: object createObject ( int modelId, float x, float y, float z, [ float rx, float ry, float rz, bool isLowLOD = false ] ) Set lowLOD to true. That will increase draw distance.
-
Oh you are confused. If you say first that you haven't tested something and also come to the conclusion that it is doesn't work. How do you come to that conclusion then? At that moment I am a 1000x more confused than you are.
-
You can look in to the future? ? I believe you for some unknown reason haha
-
For example (raw version without a lot of checks): function onClientExplosion(x, y, z, theType) local vehicle = getPedOccupiedVehicle(localPlayer) if vehicle then local x,y,z = getElementPosition(vehicle) extinguishFire(x, y, z, 30) callNextFrame(extinguishFire, x, y, z, 30) end end addEventHandler("onClientExplosion", root, onClientExplosion) callNextFrame source code:
-
Use onClientExplosion: https://wiki.multitheftauto.com/wiki/OnClientExplosion And then clear the fires for 2 frames at minimal. For the 2e frame, use the callNextFrame function. (tableRemove variable) https://gitlab.com/IIYAMA12/mta-communication-enchantment/-/blob/master/sync/sync_shared.lua#L46 (The function scope) https://gitlab.com/IIYAMA12/mta-communication-enchantment/-/blob/master/sync/sync_shared.lua#L424
-
I have never looked at the source code before, or rather I have no clue where to begin even. If you mean the mission cars that are driving in the distance? I don't think they are actually driving those with collision in mind. They are (most likely) just following a way path with a non-variable speed. When you are getting close, first the car(target) spawns in and after that the traffic around it will be carefully generated. At least that is how I would create something like that. I did that same concept with trains, and that worked surprisingly well.
-
Note: Even if you could see an vehicle at 1200m away, it wouldn't have anything to stand on. You would see it just fall down the floor, over and over.