Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 30/08/21 in all areas

  1. Sphene is a SCM Interpreter in development for Multi Theft Auto. It is capable of running the mission scripts and parsing many other game files in order to recreate the storyline, minigames and anything else the default game has within Multi Theft Auto. We will then add Co-Op on top of it. In this video you are able to see Sphene run the N.O.E mission with only very minor bugs (such as the radar sound not always working). We did not specifically target this mission but the more we are able to implement all the game logic the more parts of the game become available. This is the first mission to be fully playable from start to end.
    5 points
  2. Yeee I see pool sessions finally available in MTA SA: be the most wanted pool player in San Andreas. Excellent work, I'm impressed.
    2 points
  3. 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
    1 point
  4. This is indeed a regular Lua resource. It's also why for the time being we can't finish the cutscenes as we need object animation support for that. Sphene does have a standalone client as well (in a very early stage) that is focused on the Co-Op part alone.
    1 point
  5. Amazing work, Megadreams! I am excited for more of your content and have subscribed to your YouTube channel. How did you implement this? Is this a regular Lua resource? Or is this a special MTA client?
    1 point
  6. No problem! I like to help you. If you have any further questions about Lua scripting in general please ask.
    1 point
  7. it worked , i didn't know the use of local for declaring variables because i alwais did my scripts clientsided, i appreciate it bro, thank you :0
    1 point
  8. Hello Andres99907! Nice to meet you. I am an experienced developer and want to help you become a better Lua scripter. For this purpose I want to give you advice on how to incrementally improve your work. Did you know about local variables in connection with Lua closures? You can do amazing things with this mechanism like this. local global_index = 0 index = 0 function CreateClosure() local index = global_index + 1 -- uses the "global_index" local variable in the up-most script closure local function callback() return index -- uses the index variable of line 6 end global_index = index return callback end index = 42 -- modifies the global variable "index" which is not a local variable assert( CreateClosure()() == 1 ) assert( CreateClosure()() == 2 ) assert( index == 42 ) -- not changed by CreateClosure function Lua closures are created each time your script puts a function into a variable/table key. When you call a closure then the function is executed which then does access so called "upvalues", the local variables of closures that enclose this closure. Before you can use a local variable you have to declare it using the local keyword! Using this technique we can improve your script by remembering the variables you create during your FlarePhys function call, like this: Flares = {} Chaffs = {} function FlarePhys(x, y, z, distance, gz) local player = client local index = #Flares + 1 Flares[index] = { ["Vehicles"] = { getPedOccupiedVehicle(player) }, ["Lights"] = { createMarker(x,y,z,"corona", 1, 255,0,0) }, ["Flares"] = { createObject(2060, x,y,z) } } setElementData(Flares[index]["Vehicles"][1], "Dismissile", true) setElementCollisionsEnabled(Flares[index]["Flares"][1], false) attachElements(Flares[index]["Lights"][1], Flares[index]["Flares"][1]) moveObject(Flares[index]["Flares"][1], distance*100, x, y, gz +1.5) setTimer ( function() if isElement(Flares[index]["Vehicles"][1]) then removeElementData(Flares[index]["Vehicles"][1], "Dismissile") else destroyElement(Flares[index]["Flares"][1]) destroyElement(Flares[index]["Lights"][1]) end end, 1000, 1 ) setTimer ( function() outputChatBox(getPlayerName(player)) destroyElement(Flares[index]["Flares"][1]) destroyElement(Flares[index]["Lights"][1]) end, 8000, 1 ) end addEvent("UseFlares", true) addEventHandler("UseFlares", getRootElement(), FlarePhys) This script should work better for you because now the "creator" does not suddenly change anymore.
    1 point
  9. Ese evento que estas usando es para cuando el resource se enciende, tienes que usar un evento que se ejecute cuando el NPC reciba daño te dejo un ejemplo abajo function trollgolpeado (loss) local health = getElementHealth (source) if (getElementModel(source) == 153 ) and ( health <= 60 ) then setElementModel(source, 213) end end addEventHandler ( "onPedDamage", getRootElement(), trollgolpeado )
    1 point
  10. 1) более чем 2) выебываются 3) некорректный вопрос 4) хз, да 5) лучше обсудить с иностранцами
    1 point
×
×
  • Create New...