-
Posts
822 -
Joined
-
Last visited
-
Days Won
86
Everything posted by The_GTA
-
That proof-of-concept Video that CrosRoad95 has created looks promising.
-
MTA expects files that are specified inside meta.xml to stay immutable during the runtime of the resource. If you want to synchronize data that changes during runtime please consider using the triggerServerEvent/triggerClientEvent API instead.
-
Hello MTA community, for quite a while I have been thinking about the Lua language. I think that we can all agree on this fact: that the Lua language is simple and beautiful, especially inside MTA San Andreas. Would any of you be interested in a service that lets you compile Lua directly into machine code, for example into a stand-alone PE executable file? I am not talking about srlua or LuaJIT, rather a completely new application/web service where you could queue your Lua code for compilation. There are major benefits to compiling to machine code rather than Lua bytecode. When I'd finish this project then I would implement a C++ interface and port it into MTA aswell. Benefits of machine code translation Speed boosts during script execution due to native format of the code Code cannot be reversed into Lua anymore Lua code optimizations that the reference Lua compiler does not perform (constant optimizations, function inlining, computation node grouping, loop unrolling, etc) The ability to market your programs I am thinking about a future business partnership with the MTA team where electronically-signed machine code translated from Lua would be securely run on MTA clients. The modernization of the Lua component would bring more freedom in designing the future scripting possibilities too. If you guys voice enough interest for this product then I would be greatly encouraged to create it. There is no such product available yet and it's creation would be both interesting and challenging. What do you think, community member? - Martin
-
Dear MTA community, this resource renders mathematical formulas in scientific notation. It does solely contain internal Lua functions that should be used inside this resource. You are allowed to take the code from this resource into your own project without restrictions (if you do I would greatly appreciate a post in this thread with a link to the project you used my code in, maybe for further support). GitHub: quiret/lua_math_formulas: Math formulation renderer for MTA San Andreas written in Lua (github.com) Example commands: dt disfract dt fraction dt sqroot dt realdf dt realfract dt realexp dt realexpfract dt realrootfract dt realadd dt realaddcomplex dt realaddcomplex2 dt realaddcomplex3 dt realaddcomplex4 dt realdiv dt realdivcomplex dt realdivcomplex2 dt realdivcomplex3 dt realdivcomplex4 dt realdivcomplex5 dt off Public API: fraction createFraction( df counter, df divisor ) real createRealNumber( realvalue value ) number math_add( number a, number, b ) number math_sub( number a, number b ) number math_mul( number a, number b ) number math_div( number a, number b ) number math_pow( number a, number b ) number math_neg( number a ) number math_inv( number a ) number math_simple( number a ) bool math_eq( number a, number b ) bool math_lt( number a, number b ) bool math_le( number a, number b ) number is a regular Lua numeric value (1, 2, 3, 4, math.pi, math.exp(1), etc) any approximated value is not calculated-on in the math engine, you should stick to fractions which require natural numbers, zero or negative natural numbers (df type) objects returned by the math_ family of functions as well as createFraction or createRealNumber have the Lua operators +, -, /, *, ^, ==, <, <= overloaded to simplify usage real numbers such as math.pi or math.exp(1) are generarilly not specially implemented beyond visual representation; to simplify the implementation of real number comparison I have resorted to calculating the machine approximation and comparing based on that; improvement would require proven real number representation comparisons and their implementations; feel free to contribute any add-ons to the code in this topic which I might merge drawobj createDrawingFormula( number formula ) void drawobj.draw( float xoff, float yoff, float scale ) float(x), float(y) drawobj.getSize() Motivation: This resource should be used to get a mathematical result that is scientifically correct and is not based on a machine-accelerated approximated calculation. I created this code as part of a mathematical project I am working on that I will disclose at a later date. Noteworthy technology: A custom UI layout engine is being used to draw the formulas. Dependency graph logic is being used to perform node-based computation, reusing many results with efficiency in mind. Have fun!
-
Javascript as a secondary programming language
The_GTA replied to CrosRoad95's topic in Open Source Contributors
Language competition sounds great. Hopefully we will attract more developers that are just interested in a comfy sandbox development environment this way! JavaScript after all is very popular, and C# is powerful. In order to make integration of JavaScript and C# worth it please consider carefully suggesting our great and capable MTA client to game enthusiasts across game dev forums. -
Fascinating approach! Converting C# to Lua is a genius idea and craftsmanship. Looking forward to more. I wonder, which language is easier to teach to newcomers... C# or Lua? Development is a lot about models and converting those to code... A true OOP language like C# is ideal for that. Thank you!
-
Dear MTA community, it is very likely that some of you have been following the recent fight between Take2/Rockstar Games against IP rights violators in the GTA community. I know that this is a very sensitive issue so I want to give you some legal advice about using scene2res safely from now on: If you are using scene2res to convert your GTA:SA map (original, TC, etc) into a MTA server format, then you must make sure to have the permission of all content creators before offering the game files on a public server. In our case this is most likely Rockstar Games/Take2 themselves. I cannot help you with content ID (very very complicated) so you have to act responsibly/in good faith. If you are creating scene2res converted maps for personal use (you are the only one playing on the server) then you have nothing to worry about. Generally I cannot recommend the use of scene2res on any servers anymore because it is too easy for the common user to get it wrong. Instead a new tool is required that would directly convert the game files from a rightful game installation itself. Every connecting MTA player would have to perform that conversion himself. This new and different process would be considered fair-use. I have been very clear on Twitter about this grave situation but here is a quick breakdown: the re3 / revc project are promoting the easy access to GTA compatible/reverse-engineered executables, so Rockstar Games/Take2 are very vigilant about removing their rightfully owned game files from the internet using DMCA. Respect other people's work, even if it comes from a big corporation. While it was questionable to upload game files in the past, Rockstar Games/Take2 could have acted under the assumption that only they could legally provide a GTA executable so they chose to allow many so-called "mods". Good luck and stay righteous! ?
-
You're welcome! Happy to be part of your vision. Not so sure about your alpha fix claims because I happen to be deeply into this research topic of per-pixel rendering order but it sure does help a little, maybe enough to fit your cause ? Replacing the internal GTA:SA rendering calls with MTA versions sounds fun, I hope you achieve great new creative control over MTA server content this way!
-
OK. I forgot to subtract a zero there, should trim off the trailing '\0' now.
-
Thank you very much for your valuable feedback! Based on the example DFF file that you have provided me (skyscr01_lawn.dff) I was able to detect an issue in the geometry chunk vertex-prelighting color reading. Instead of reading the color channels as uint8/byte, I was reading them as float ? About 20 minutes ago I have pushed a new commit to the GitHub repository which can now load the mentioned DFF file. If you find any further bugs then please post again, I will evaluate whether I want to support the DFF file and then fix any bugs. I am very interested in the MTA-backed DFF renderer that you have created. It seems like a fun project and I like it.
-
No. Go request such a feature on the MTA Github.
-
Actually the bug is gone for me? No idea how. I just pray that it does not reappear. The bug has disappeared _without downloading another MTA:SA client version_.
-
A bummer if it is to prevent TXD cheats. Since I am the developer of Magic.TXD I would be heartbroken if valid TXD mods like mipmaps are disabled by default. But I might pretend to not care just to have a good relationship with the MTA devs... I did try to download the earliest possible 1.5.8 build on nightly.multitheftauto.com but it seems like all the downloadable builds have been patched already. Or the data files are downloaded independently of the nightly.
-
I did notice that mipmaps are broken and did the following bug report: https://github.com/multitheftauto/mtasa-blue/issues/1774 Our findings could be related.
-
Please note that there exists another MTA bug: the camera matrix is sometimes wronly returned. See this Github issue for further details. I noticed that there was a tiny bug in the get_screen_coordinates function if the world coordinate was directly on the middle vertical line of the screen. Then the screen-y coordinate would be returned as inverted. Even though that issue would be virtually never encountered I decided to give you this following script which has the issue fixed: local function get_screen_coordinates(wx, wy, wz) local camMatArray = getElementMatrix(getCamera()); local camMat_right = camMatArray[1]; local camMat_forward = camMatArray[2]; local camMat_up = camMatArray[3]; local camMat_pos = camMatArray[4]; local camMat = Matrix(); local sW, sH = guiGetScreenSize(); local s_ratio = sH / sW; local _,_,_,_,_,_,_,fov = getCameraMatrix(); local fovRad = math.rad(fov/2); local tanfov = math.tan(fovRad); local farclip = getFarClipDistance(); camMat:setForward(Vector3(camMat_forward[1], camMat_forward[2], camMat_forward[3])); camMat:setRight(Vector3(camMat_right[1] * tanfov, camMat_right[2] * tanfov, camMat_right[3] * tanfov)); camMat:setUp(Vector3(camMat_up[1] * tanfov * s_ratio, camMat_up[2] * tanfov * s_ratio, camMat_up[3] * tanfov * s_ratio)); camMat:setPosition(Vector3(camMat_pos[1], camMat_pos[2], camMat_pos[3])); local invCamMat = camMat:inverse(); local invVec = invCamMat:transformPosition(wx, wy, wz); local function to_real_coord(val) return ( val / 2 ) + 1/2; end local ratWidth, depthDist, ratHeight = invVec.x, invVec.y, invVec.z; -- Screen top is -1 but should be 1 to match the up vector perception. ratHeight = -ratHeight; if (depthDist > 0) then ratWidth = ratWidth / depthDist; ratHeight = ratHeight / depthDist; if (math.abs(ratWidth) <= 1) and (math.abs(ratHeight) <= 1) then return to_real_coord(ratWidth), to_real_coord(ratHeight), true; end end if (ratWidth == 0) and (ratHeight == 0) then return 1/2, 1/2; elseif (ratWidth == 0) then return 1/2, to_real_coord(1 / ratHeight); elseif (ratHeight == 0) then return to_real_coord(1 / ratWidth), 1/2; end local dist_to_width = math.abs(1 / ratWidth); local dist_to_height = math.abs(1 / ratHeight); local scale_dist = math.min(dist_to_width, dist_to_height); ratWidth = ratWidth * scale_dist; ratHeight = ratHeight * scale_dist; return to_real_coord(ratWidth), to_real_coord(ratHeight), false; end
-
Hello SryMan, welcome to the MTA scripting forums! Did you try searching for information on the MTA wiki? There is a helpful search bar in the left navigation pane and I typed "scoreboard" into it to find the following interesting article: https://wiki.multitheftauto.com/wiki/Resource:Dxscoreboard At the bottom of the article is an example on how to add your very own column to the dxscoreboard resource! Please take a look at it and post any questions that you may have. - Martin
-
Hello OrbTanT, your script seems to use external map data that is not provided in your post. But you mention the map of a potential MTA resource. Could you please try to find the map lines in question that show the erratic behavior in connection with your script? We would like to have data that we can test instead of combing through potentially an entire map file.
-
Hello unkwn, I think the issue is simple code structure. The problem is that you are creating a ped while you do not know what skin it should have at first. You should first determine the array of available skins and then create the ped: addEvent( "onZombieSpawn", true ) function RanSpawn_Z ( gx, gy, gz, rot, zombieType, row ) local safezone = 0 local allradars = getElementsByType("radararea") for theKey,theradar in ipairs(allradars) do if getElementData(theradar, "zombieProof") == true then if isInsideRadarArea ( theradar, gx, gy ) then safezone = 1 end end end if safezone == 0 then if table.getn ( everyZombie ) < newZombieLimit then if not rot then rot = math.random (1,359) end local ZombiePedSkins = false; if (zombieType == 1) or (zombieType == 2) then ZombiePedSkins = {10} elseif (zombieType == 3) then ZombiePedSkins = {11} end if (ZombiePedSkins) then local randomZskin = math.random ( 1, table.getn ( ZombiePedSkins ) ) local zomb = createPed( tonumber( ZombiePedSkins[randomZskin] ), gx, gy, gz ) if (zomb ~= false) then setElementData( zomb, "zombie:type", zombieType ) if zombieType == 1 then setElementData( zomb, "head:n", 1) setElementData( zomb, "head:now", 0 ) elseif zombieType == 2 then exports.extra_health:setElementExtraHealth ( zomb, 400 ) setElementData( zomb, "head:n", 3 ) setElementData( zomb, "head:now", 0 ) elseif zombieType == 3 then setElementData( zomb, "respawn:zombie", row ) exports.extra_health:setElementExtraHealth ( zomb, 800 ) end setElementData ( zomb, "zombie", true ) table.insert( everyZombie, zomb ) setTimer ( function (zomb, rot) if ( isElement ( zomb ) ) then setPedRotation ( zomb, rot ) end end, 500, 1, zomb, rot ) local chaseanim, checkspeed = getZombieType ( zomb ) setTimer ( function (zomb) if ( isElement ( zomb ) ) then setPedAnimation ( zomb, "ped", chaseanim, -1, true, true, true ) end end, 1000, 1, zomb ) setTimer ( function (zomb) if ( isElement ( zomb ) ) then setElementData ( zomb, "status", "idle" ) end end, 2000, 1, zomb ) triggerClientEvent ( "Zomb_STFU", getRootElement(), zomb ) end end end end end end addEventHandler( "onZombieSpawn", getRootElement(), RanSpawn_Z ) Hope this helps! - Martin
-
You mean the TXD that you replaced on your server, if you connect to another server the same textures are visible even though that server does not have your resource? That could be a MTA bug if you mean that...
-
Thank you for posting about this bug. I think you can fix this by, instead of setting the indicator intensity to 0, set the indicator light intensity to a 0.2 or something close to that. Then you also have to add fog effect as well as ambient lighting of GTA:SA so that the texture looks as if it were rendered by GTA:SA. I will look into it tomorrow.
-
Hello iwalidza, I was hesistant to respond because I have no experience in the MTA implementation of web services but I think you want to read this wiki article: https://wiki.multitheftauto.com/wiki/Resource_Web_Access It contains helpful examples on how to create a Lua-based HTML interface.
-
Hello PeeQ, do you know about the difference between server-side and client-side scripts? It looks like your first script is a server-side script because you are using the server-side "onMarkerHit" event. Is it intentional that you want to create server-side peds and markers? I am going to assume that it is, so let's fix your script! What iwalidza tried to do is put both code onto the client-side. But that user forgot to use the client-side onClientMarkerHit event instead of the server-side onMarkerHit. Please test your code next time, iwalidza. In order to synchronize data between server and client you have to use MTA event functions. We want to create a remote client-side event called "onClientShowGUI" and put our GUI code into an event handler of that event. Then inside of the server-side onMarkerHit event... addEventHandler("onMarkerHit", binco1b, function(hitElement) if (getElementType(hitElement) == "player") then triggerClientEvent(hitElement, "onClientShowGUI", root); end end ); I recommend you to read up on MTA events to catch up on good MTA Lua scripting
-
I see that it is the same problem many times so let's look at one examplein line 29: if (info.indicator_left_on == true) then Do you know about Lua tables? You don't have any "info" variable inside of this function. I think you meant to call the getVehicleIndicatorLights function with the vehicle of the local player as argument and then store the result into a local "info" variable. Try doing that at the top of that function. Then there are many followup errors because you try to look at invalid variables like "shader_left". You forgot to create those shaders inside of the info table between like 18 and 19. And then you have to use those variable from inside the vehicle indicator light info of any vehicle table. I recommend you to try using Lua tables! Lua tables are essential for good Lua scripters.
-
Glad to hear that your issue has been resolved.
-
I think the message is confusing. The timer just waits 2 seconds and not 5 minutes. I doubt that you are typing "/rp" two times faster than 2 seconds. But the script above does prevent ... "rapid" enabling. And then there is this weirdness about a timer inside of a timer. Maybe try increasing some timers?