-
Posts
6,097 -
Joined
-
Last visited
-
Days Won
218
Everything posted by IIYAMA
-
They are not mta elements. But there are functions that can get the position and rotation of them. I am very sure that you have already found them. Find them if you haven't! ......... ............. ........... .............. .......... After that. The function getElementMatrix can help you with the vehicle orientation. https://wiki.multitheftauto.com/wiki/GetElementMatrix And on that same page there is something that creates a matrix the same way as the function above. But gives you also the ability to get the matrix without using an actual element. (Last example) function getElementMatrix(element) local rx, ry, rz = getElementRotation(element, "ZXY") rx, ry, rz = math.rad(rx), math.rad(ry), math.rad(rz) local matrix = {} matrix[1] = {} matrix[1][1] = math.cos(rz)*math.cos(ry) - math.sin(rz)*math.sin(rx)*math.sin(ry) matrix[1][2] = math.cos(ry)*math.sin(rz) + math.cos(rz)*math.sin(rx)*math.sin(ry) matrix[1][3] = -math.cos(rx)*math.sin(ry) matrix[1][4] = 1 matrix[2] = {} matrix[2][1] = -math.cos(rx)*math.sin(rz) matrix[2][2] = math.cos(rz)*math.cos(rx) matrix[2][3] = math.sin(rx) matrix[2][4] = 1 matrix[3] = {} matrix[3][1] = math.cos(rz)*math.sin(ry) + math.cos(ry)*math.sin(rz)*math.sin(rx) matrix[3][2] = math.sin(rz)*math.sin(ry) - math.cos(rz)*math.cos(ry)*math.sin(rx) matrix[3][3] = math.cos(rx)*math.cos(ry) matrix[3][4] = 1 matrix[4] = {} matrix[4][1], matrix[4][2], matrix[4][3] = getElementPosition(element) matrix[4][4] = 1 return matrix end With this matrix you can attach stuff with a render event. Of course I understand that it might look a little bit complex. But it is really the only way without doing very complex calculations.
-
Everything you need is on this page: https://wiki.multitheftauto.com/wiki/GetElementMatrix Use getElementMatrix on to the camera element to get it's matrix. And use the functions in the examples to get the offset from the orientation(matrix) of the camera. Which you can later move to with your camera. It gives you a lot of freedom to do really crazy stuff.
-
I wouldn't say that so quickly. To me his example looks valid. /add d six random[x] = y (or overwrite, `set` would be a better command based on it's functionality) /rem d if random[x] then random[x] = nil end
-
https://wiki.multitheftauto.com/wiki/IsTransferBoxActive See the example of that page.
-
No, add it ONLY to the resource which is going to hide the bar. This makes sure that the script is downloaded before others and starts early on. If you do not do this, this script will be started after the download bar is finished. Check isTransferBoxActive, because it half of your work: https://wiki.multitheftauto.com/wiki/IsTransferBoxActive Use https://wiki.multitheftauto.com/wiki/DxDrawRectangle To cover up the download bar. (enable postGUI) Syntax bool dxDrawRectangle ( float startX, float startY, float width, float height [, int color = white, bool postGUI = false, bool subPixelPositioning = false ] ) Do not cover the whole screen. Keep the user in control. http://bokardo.com/principles-of-user-interface-design/#keep-users-in-control Trouble with using this with onClientRender? This might be handy:
-
https://wiki.multitheftauto.com/wiki/Meta.xml <download_priority_group /> If not set, the download priority group for a resource defaults to 0. If this is set higher than 0, then the resource will be downloaded and started on the client earlier than other resources. If set to less than 0, the resource will be downloaded and started on the client later than other resources. + See example of isTransferBoxActive. \/ https://wiki.multitheftauto.com/wiki/IsTransferBoxActive
-
Hmm interesting. It isn't bug free yet. For example if you destroy a vehicle and create a vehicle at the same time, the event wouldn't be triggered. A more accurate way would be using an invert loop, which checks if the vehicle's at the end of the table are new. If not, then you can break the loop. New vehicle's should be afaik always at the end.
-
Or you can use loadstring. local value = true loadstring("text = " .. tostring(value))() https://www.lua.org/pil/8.html @Megadreams hmm interesting, I didn't know that you could also make global variables like that.
-
The latest thing you can do to improve the load + download time for a lot of players, is achieved by compile the script files: https://luac.multitheftauto.com/ Reduces load and download time. But do not enable Extra obfuscation. Because this will increase the load time. (Except if you want nobody* to have Access to it)
-
iprint(getAllPlayerInDimension (0)) First debug. After executing the function, it returns a table which contains all players from that dimension. Just run the code and check your debug-console.
-
Well you might be able to make it with: "onVehicleEnter" -- > save ------------------- "onPlayerDamage" -- maybe a delay? (not sure) isPedInVehicle -- > no vehicle? -- > fall off
-
No.no.no getRootElement is a function. root is a predefined variable that contains the root element. When you execute getRootElement it will return the value: root element: getRootElement == root -- false -- call the getRootElement function getRootElement() == root -- true So yes, in the end it doesn't matter which one you use. Except that with getRootElement you have to make one function call more before you have access to the value.(performance)
-
See my post, I did edit it afterwards.
-
function render () local timeNow = getTickCount() local alpha = (timeNow % 510) if alpha > 255 then alpha = 255 - (alpha - 255) end local color = tocolor(255,255,255, alpha) end Each 1 alpha unit of 255 = 1 millisecond. Very easy example. Which counts from: 0 > 255 > 0 > 255 > 0 etc. If you want some custom timing: (2s = full animation ON/OFF) local duration = 2000 local alpha = (timeNow % duration / duration) * 510
-
99% of people who request this do not learn anything about it, since the do not know lua. They do not even realize that learning it that way doesn't work at all. The only thing they do learn about it, is that it is really easy to let other people doing their work for free. So, what makes you that 1%? That precious 1%, which I think they deserve that kind of attention. The situation: To receive finished code without knowing lua.
-
Yes you need to add it again. Better to clear the innerHTML in text-chat instead.
-
use JS executeBrowserJavascript ( webBrowser, 'document.getElementById("element-id").innerHTML = ""') https://wiki.multitheftauto.com/wiki/ExecuteBrowserJavascript
-
setBrowserRenderingPaused = probably stopping the browser with making cycles. Probably stop doing this: You will need to use guiSetVisible to hide the gui: https://wiki.multitheftauto.com/wiki/GuiSetVisible Yet I recommend you to doing both, because afaik the browser doesn't stops rendering when you hide the gui. (will save you some performance)
-
[QUESTION] setElementRotation and getCameraMatrix.
IIYAMA replied to Exilepilot's topic in Scripting
Denny199 his reply is very useful. This will give you everything you need. -
[QUESTION] setElementRotation and getCameraMatrix.
IIYAMA replied to Exilepilot's topic in Scripting
I doing stuff like that with: local camera = getCamera() local matrix = getElementMatrix(camera) local rotX, rotY, rotZ = getElementRotation(camera) -
This doesn't work like that: getTeamName(getPlayerTeam(p))~= ("Criminals" or "Terrorists") This is how lua reads it: 1. 2. 3. So how to solve this?
-
marker = createMarker(v[1], v[2], v[3], 2,"corona",2,150,255,150,150) /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ In your code: coord == v[1] And v[2], v[3] are left out. Which gives you this result: marker = createMarker(v[1], 2,"corona",2,150,255,150,150) And that isn't what you want.
-
animationCommand(client) animationCommand2(client) function animationCommand ( player ) setPedAnimation ( player, "ped", "SEAT_idle", -1, true, false, false ) end function animationCommand2 ( player ) setPedAnimation ( player ) end Do not abuse the source variable.
-
It seems hiding content really helps to give clear information. Thank you very much too!
