-
Posts
6,089 -
Joined
-
Last visited
-
Days Won
216
Everything posted by IIYAMA
-
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?
-
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?
-
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:
-
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.
- 28 replies
-
- 3
-
-
- trains
- not compiled
-
(and 2 more)
Tagged with:
-
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.
-
Locked reason: double post
-
I am not exactly sure what the raw mathematics are . But you can use for your first iteration this function: local screenPosX, screenPosY = getScreenFromWorldPosition ( x, y, z, 10, true ) if screenPosX and screenPosY then end It will flatten the complex 3D orientation and therefore allows you to calculate the rotation: https://wiki.multitheftauto.com/wiki/FindRotation
-
Did you assign an ID to the object? Afaik you to add (manually) id's with setElementID.
-
Nope, just the way you are doing it in your example. A flat structure, because each complexity in the structure will make it more complicated to save. You can later add a next layer on top of your table, to improve searching performance, if you so desire. Finding your item? Do it how a human would do, check every item in the list until you find the right one and stop searching.
- 1 reply
-
- 2
-
-
-
Options: A. use the command: /refreshall B. Empty your client cache MTA San Andreas X\mods\deathmatch\resources Source:
-
hmm, it is kind of a strange error. Since freeroam doesn't request the files from the path /data/ rows={xml='stats.xml', attrs={'name', 'id'}}, File fr_client.Lua. Line 461 This error is showing when starting freeroam or always?
-
And are the files inside?
-
Those files are located in: \[gameplay]\freeroam Try to unzip the resource (and delete the zip)
-
@anlaltnay Download the latest freeroam resource from: (after downloading, located in [gameplay]) https://github.com/multitheftauto/mtasa-resources
-
You can use the addCommandHandler. addCommandHandler ( "givemoney", function (responsibleElement, commandName, teamName, money) iprint("givemoney command used") if responsibleElement and getElementType(responsibleElement) == "console" then iprint("the one used the command is the console") money = tonumber(money) if teamName and money then iprint("parameters are valid!") -- do your stuff end end end)
- 1 reply
-
- 1
-
-
In most cases not. It does indeed reduce memory, but that only matters when the variable contains a lot of data. For example: A variable that contains a table reference with > 1000 items. Cleaning this data will not boost your performance directly, it will only allow your users to use less HDD memory when they do not have enough ram installed. Which will indirect result in improving the performance. People with 4 gb ram installed on a windows 10 computer, that is segment you are helping.
-
You might be able to test that. Initial Put yourself or the vehicle you want to test in the air. Gravity to 0. Speed to 0. Start Write down the velocity for every frame. Set the default gravity and test how the speed is changing for the first few frames. Note: keep in mind that vehicles also have their own mass.
-
Note: you can also apply the matrix of the ped to the projectile. It might not have the correct rotation in the beginning, but you can correct that. setElementMatrix
-
Here some code snippets I ripped out of one of my scripts. The code was used to calculate the new projectile position based on frame time. This would terminate different projectile speeds based on FPS. -- add function findRotation local findRotation = function ( x1, y1, x2, y2 ) local t = -math.deg( math.atan2( x2 - x1, y2 - y1 ) ) return t < 0 and t + 360 or t end -- add function findPitch local findPitch = function (camerax,cameray,cameraz,pointx,pointy,pointz) local dX=camerax-pointx local dY=cameraz-pointz local dZ=cameray-pointy local pitch=math.atan2(dY,math.sqrt(math.pow(dZ,2) + math.pow(dX,2))); return pitch end local xr, yr, zr = getElementRotation(source, "ZXY") -- source is projectile -- xr, yr, zr is saved inside of projectileData.rotation local targetX, targetY, targetZ = getElementPosition(target) -- target is projectile local rotZ = findRotation(newX, newY, targetX, targetY) + 180 local pitch = findPitch(newX, newY, newZ, targetX, targetY, targetZ) local rotX = pitch*(180/math.pi) local newRotX = projectileData.rotation.x local newRotZ = projectileData.rotation.z local rotationDistanceX = (projectileData.rotation.x - rotX + 360) % 360; if (rotationDistanceX > 180) then rotationDistanceX = 360 - rotationDistanceX newRotX = newRotX + math.min(rotationDistanceX, behaviourData.rotationSpeed * speedMultiplier) else newRotX = newRotX + -math.min(rotationDistanceX, behaviourData.rotationSpeed * speedMultiplier) end local rotationDistanceZ = (projectileData.rotation.z - rotZ + 360) % 360; if (rotationDistanceZ > 180) then rotationDistanceZ = 360 - rotationDistanceZ newRotZ = newRotZ + math.min(rotationDistanceZ, behaviourData.rotationSpeed * speedMultiplier) else newRotZ = newRotZ + -math.min(rotationDistanceZ, behaviourData.rotationSpeed * speedMultiplier) end projectileData.rotation.x = newRotX projectileData.rotation.z = newRotZ local rotationZ = -projectileData.rotation.z if creatorVehicle then -- if the projectile creator was a vehicle, then add 180 to invert the rotation. rotationZ = rotationZ + 180 end setElementRotation(element, projectileData.rotation.x, projectileData.rotation.y, rotationZ, "ZXY")
-
A local function is just the function value saved inside of a local variable. Like this (a local available before the function is defined): local test function test () end or this (a global, as well as a local after the local keyword): function test () end local test = test or this: (a local variable, available after the function) local test = function () end or this: (a local variable, available in and after the function) local function test() end So when do you need to use it? The same way as just a regular local variable. Variables that are accessed a lot of time. (onClientRender) Variables that are only available within it's scope. Variables that are temporary required. etc.
-
?
-
@VaporZ Stop moving, you can easily ask that question here. Now you are just pushing other people their topics down, that deserve the same attention as yours.
-
[HELP] Slot inventory with different sized items
IIYAMA replied to Dzsozi (h03)'s topic in Scripting
Nope, there are other methods, like checking if rectangles are colliding. But if you use 2, it doesn't mean it is more difficult. Infact it is a lot easier to create a computed version of your grid. It tells you exactly which cells are being used and you can throw it away when you do not need it any more. An item ID, which is the one of the item you want to move. This value is an integer, the first column located in your db table. -
[HELP] Slot inventory with different sized items
IIYAMA replied to Dzsozi (h03)'s topic in Scripting
Double id's are not allowed. Your database will never generate the same ID, if the column is correct set-up. If you move the item on top of the same item, it should consider those cells as empty. isSlotFree(x, y, w, h [[, ignoreID int ]]) The checking box is the computed version of the grid, where each cell has data applied. (Unlike just the start position)