-
Posts
140 -
Joined
-
Last visited
Everything posted by AlexTMjugador
-
No se puede hacer lo que propones, aunque teniendo en cuenta que hay 65536 dimensiones diferentes es factible meter a cada jugador en una diferente. En cuanto a posibles objetos que quieras que sean comunes a esas dimensiones, puedes hacer un script que haga coincidir la dimensión de esos objetos con la de cada jugador en el lado del cliente.
-
Firstly, in order to the color transition look smooth, you need to do it clientside using the onClient(Pre/Hud)Render family of events. Timers can be too fast for clients with low FPS and too slow for clients with high FPS, so smooth transition is not guaranteed when using them. About the actual question, I guess that you want your transition to look like a real rainbow. Due to the sun light composition and phenomena which occurs when it hits water in a certain way, a rainbow allows you to see the whole visible color spectrum: As you can see, the highest frecuency (lowest wavelength, 400 nanometers) color is violet, while the lowest frecuency (highest wavelength, 700 nanometers) color is red. We can use interpolateBetween to get the intermediate colors' wavelength and therefore get a rainbow colored car, but how the hell can we transform back the wavelength to actual RGB values usable in setVehicleColor? The answer is simple: the wavelengthToRGBA useful function (I assume truncating the alpha value does not break the color translation in this case). So the code you need to get everything working is: -- Ensure this variable gets set to the vehicle you want the effect on local veh = getPedOccupiedVehicle(localPlayer) -- USEFUL FUNCTIONS -- local function wavelengthToRGBA(length) -- Copied and pasted from the wiki local r, g, b, factor if (length >= 380 and length < 440) then r, g, b = -(length - 440)/(440 - 380), 0, 1 elseif (length < 489) then r, g, b = 0, (length - 440)/(490 - 440), 1 elseif (length < 510) then r, g, b = 0, 1, -(length - 510)/(510 - 490) elseif (length < 580) then r, g, b = (length - 510)/(580 - 510), 1, 0 elseif (length < 645) then r, g, b = 1, -(length - 645)/(645 - 580), 0 elseif (length < 780) then r, g, b = 1, 0, 0 else r, g, b = 0, 0, 0 end if (length >= 380 and length < 420) then factor = 0.3 + 0.7*(length - 380)/(420 - 380) elseif (length < 701) then factor = 1 elseif (length < 780) then factor = 0.3 + 0.7*(780 - length)/(780 - 700) else factor = 0 end return r*255, g*255, b*255, factor*255 end -- ACTUAL SCRIPT -- local startTime = getTickCount() local function rainbowColorVehicle() -- Periodic [0, 1] progress value with 3000 ms period local progress = math.fmod(getTickCount() - startTime, 3000) / 3000 -- You can invert the color order replacing 400 with 700 and viceversa -- The transition can look more interesting by using another easing function local length = interpolateBetween(400, 0, 0, 700, 0, 0, progress, "Linear") -- Get and apply our color local r, g, b = wavelengthToRGBA(length) setVehicleColor(veh, r, g, b, r, g, b, r, g, b, r, g, b) end addEventHandler("onClientPreRender", root, rainbowColorVehicle) A disclaimer: this might not be the most efficient algorithm out there to achieve this, but providing that you know what the undolatory theory of light is it should be very understandable and easy to modify or mantain.
-
We can't see what you have done wrong in your script, so we can't answer your question. Post the complete code first.
-
Translating wiki and 404.
AlexTMjugador replied to mommytellme's topic in Site/Forum/Discord/Mantis/Wiki related
That error shows because the page you are looking for a page that doesn't exist. To create it, type "PL/Changes_in_1.5.1" in the sarch box and click on the red link which appears after pressing Enter, or simply follow this link. -
Precisamente, la gracia de sustituir funciones con ese fin es que el script tuyo no se dé cuenta de la sustitución. Por ejemplo, que todos los resultados de getRealTime tengan un valor infinito es algo detectable fácilmente, pero se puede hacer que esa función dé una fecha arbitraria real que va avanzando con el tiempo, haciendo así inútil casi cualquier intento de detectar la manipulación en el propio MTA. Y si me dices que para evitar eso validas fechas con un servidor tuyo, te repito que callRemote se puede reemplazar, de manera que devuelva unos argumentos que satisfazcan unas determinadas condiciones, y con un retraso determinado para simular la latencia que introduce una conexión de red, que puede ser aleatoria si hace falta. Además, si bien hacer todo eso que dije ahí arriba puede parecer complicado, siempre queda la posibilidad de que alguien decompile tu script (no es difícil si sabes cómo hacerlo) y le quite todas esas comprobaciones Hagas lo que hagas, conque tan solo un comprador ejecute el script en su servidor ya estás expuesto a que hagan lo que quieran con él, y no hay nada que puedas obligar hacer al dueño del servidor para que deje de ser factible su robo. Por eso me parece algo inverosímil afirmar tener un control "absoluto" sobre un script que se ejecuta en un ordenador que tú no puedes administrar. Lo único que realmente puede "distraer" la visión no autorizada del script es descargarlo mediante HTTPS para ejecutarlo sin guardarlo en el disco duro, y aún así tengo dudas acerca de pagar u obtener un certificado SSL habiendo programas visualizadores de paquetes que desencriptan el tráfico web seguro con tan solo cambiar unas configuraciones en el cliente. De nuevo, si sabes cómo hacerlo, tampoco es tarea difícil. Conclusión: creo que merece más bien poco la pena implantar esas medidas de seguridad en un script, porque alguien que sepa decompilarlo posiblemente sepa también otros métodos para salirse con la suya.
-
I think that Crossover can help you playing MTA in Mac OS, but I haven't tested it myself. Look for it on the Internet and tell us whether it did or didn't work, in order to help more people in your situation
-
The latest commit to MTA: SA main branch source code was published just 3 days ago, so I won't call MTA dead yet.
-
Intentar recuperar el valor que anteriormente tenía una variable me parece un poco imposible, debido a que desde Lua no se tiene el control suficiente sobre cómo opera el colector de basura en funciones (suponiendo que no uses la librería de funciones de depuración). Si bien MTA exporta sus funciones al entorno global de cada máquina virtual, no puedes recuperar las funciones originales si las sobreescribes. Y aún guardándolas en algún lugar previamente, buena suerte encontrándolas. ¿Qué pasa si uso alguna funcionalidad de la librería debug para evitar eso? Esas funciones se pueden reemplazar igualmente, dejando también a tu script indefenso.
-
callRemote y fetchRemote son también funciones vulnerables a ser reemplazadas en Lua, por mucho que el script que las use esté compilado. Cualquiera con un mínimo de conocimientos podría analizar la respuesta de tu servidor y simularla en Lua de manera transparente para tu script. Y viendo lo poco que se puede hacer en Lua para evitar que tu código se ejecute en una sandbox, yo preferiría cobrar más y dárselo al cliente tal cual que marear la perdiz con esas medidas de seguridad casi conspiranoicas, más efectivas en ahuyentar clientes que en cumplir su cometido.
-
Compiling and encrypting were never meant to be secure measures against unwanted script source code reading (but they do however stop most of the script stealers in this community), so they can't be qualified as a "solutions to protect from leaking" because they don't really protect much. I don't really know why people do tend to call secure things they can't just simply figure out how to crack. It's like calling secure a 1 ASCII character password just because no one apart from you knows it. I had an idea on how could be luac.multitheftauto.com source code decrypted and decompiled since a while ago, but now that GTX said that so clearly... Jesus, I could do that myself in a matter of minutes (being the most part of that time compiling MTA: SA again). You only need to have a bit of brain and be able to understand (not even write) C++ code.
-
GTA: SA world is a square whose side is 6000 units long, starting in -3000 and ending in 3000 for the X and Y axes. Therefore, to get a random 2D position within the world, just use: pos = Vector2(math.random(-3000, 3000), math.random(-3000, 3000)) In order to check if there is water in that position, just look at the result of this function call: anyWaterInPos = testLineAgainstWater(pos.x, pos.y, -3000, pos.x, pos.y, 3000) Note that the -3000 and 3000 Z coordinates are some kind of dummy values to just check if there is any water in that position, which is what you may (or may not) want. You can use the ground height value returned by getGroundPosition to effectively control the length of the line you are testing water against, relative to the ground the player can step on.
-
Not really. I haven't seen any bounty for finding how to decrypt and decompile scripts processed by luac.multitheftauto.com and people which have done it claim in this forum it is as easy as "unlocking your bike's lock". About the OP request, there are no public instructions on how to decompile Lua code, so you will need to think by yourself or write the whole script again (providing that it is truly yours).
-
It looks like your PHP page doesn't return useful data to fetch. Have you tried using callRemote? It submits a different request to the server, so you can expect it to return different results.
-
That doesn't work because I admit I confused you a bit. Continue reading and you'll know why Firstly, the built-in HTTP server is just a HTML server. It is not able to process PHP scripts, although Lua code can be embedded within HTML pages to provide dynamic output, in a somewhat similar fashion to PHP. Therefore your PHP pages won't work even if you manage to add them by using the tag in the meta.xml file.As you may have thought, the most convenient thing to do for exporting web functions to your scripts is using HTML with inlined script, so that you don't need to set up external webservers and everything gets easier to manage. However, that's not possible in your case, because you need PHP in order to get players' location. So the real question is: can we do something to circumvent this shortcoming? It seems impossible to get the result of that script if fetchRemote isn't able to do anything outside the server's HTTP interface, right? Not quite. And here's where things get interesting: do you remember that your script is clientside? The clientside fetchRemote is limited, but the serverside version is not: with the serverside version you can fetch the result of any webpage in any server and port. That means that you can host a different server, even if it's on the same machine, and get the result of it by only using fetchRemote in the server. Therefore, we can now reformulate the previous question: what we can do to get the result of that serverside fetchRemote in a client? Well, providing that you are already using element data, you only need to call the function serverside and set the element data there, and make sure that the client knows how to deal with that element data change accordingly. You can use the onClientElementDataChange event for that, if you want or need to. If you want to script your own data transfer approach, which can be more efficient in terms of bandwidth, use triggerClientEvent and you are set.
-
i Got banned for 13 days or more for Cheating
AlexTMjugador replied to omar2pro's question in Client
Maybe because you used cheat software and got caught by MTA? -
In order to fetchRemote to return something more useful from your server, you should access a certain file within a certain resource. For example, to read index.htm from the resource web: http://IP:PORT/web/index.htm. To know how you can publish a resource or file to the web interface, you can read this wiki article and/or see how some default resources have used the web interface (for example, performancebrowser).
-
You should use the server HTTP port with fetchRemote.
-
Because it is the responsibility of servers to decide what they want their players to download and see and what not. MTA is just intended to provide a pure sandbox experience upon which scripters are able to do almost anything they want with the game.
-
Optimizar el código está bien y es un requisito indispensable para que sea de calidad, aunque creo que tampoco es bueno hacerlo ciegamente como alguno de por aquí pensará, aplicando en cada línea consejos que no optimizan el algoritmo como tal (donde normalmente más rendimiento se pierde). Quizá esté claro que esa fórmula aplica Pitágoras (o bien su equivalente definición e interpretación geométrica de módulo de un vector), pero creo que todo el mundo la encontraría menos agradable a la vista que llamar a una función getDistanceBetweenPoints. Y eso sumado a un desarrollador inexperto, despistado y/o carente de conocimientos matemáticos puede generar más de un error de programación, especialmente cuando este tipo de optimizaciones se van acumulando. "Es que se ejecuta el doble de rápido, y el código no se lee tan mal". Dicho así, tiene razón. ¿Por qué hacer algo relativamente mucho más lento si se puede hacer rápido y se puede entender sin gran dificultad? Pero hay que tener en cuenta la pérdida de legibilidad y compararla con el rendimiento ganado: Supongamos que ciertos recursos usan esa función 1000 veces en cada cuadro (que son bastantes más veces de las que normalmente he visto), y que el juego se ejecuta a 10 FPS. Tomando tus propios datos, renderizar cada cuadro tardaría 100 milisegundos, de los cuales 0,00048 * 1000 = 0,48 ms se emplearían en llamar a esas funciones. Esos 0,48 ms, de reducirse a 0,4 ms (0,0004 * 1000) usando la mejor optimización que propones, supondrían un ahorro de 0,08 ms que se invertirían, a igualdad de otros factores, en que el juego se ejecutase ≈ 0,0080064 FPS más rápido (100 - 0,08 = 99,92 ms/cuadro; 1000 / 99,92 ≈ 10,0080064 cuadros en un segundo). ¿Merece entonces la pena hacer el código menos legible con tal de arañar centésimas de FPS en un caso práctico? Creo que la respuesta más sensata es que no, porque nadie notará el beneficio sino incluso el perjuicio causado a otra gente que vea tu código. Si aún así alguien prefiere hacer optimizaciones de este tipo, que ahorran el tiempo que la luz tarda en recorrer en vacío la longitud de una ballena azul (30 metros), por mí pueden seguirlas haciendo, pero las razones para actuar así son más dogmáticas o de efecto placebo que otra cosa.
-
The code I posted is not a public variable in a proper OOP way, so sorry for that. It is wonderful how Lua lets you do what you want even if it's something "new", don't you think? That syntax you posted won't work, but with this code it will: function Person(name, address) local self = {} local person_name = name self.address = address function self.getName() return person_name end function self.getAddress() return self.address end return self end That is the proper way to have public variables in Lua OOP: you can get them by using either object.variable or object:getVariable (in this case, object.address and object:getAddress).
-
fetchRemote can't be used clientside with webpages hosted in any server but the server the client is connected to. If your domain name resolves to the MTA: SA server IP and HTTP port used by MTA: SA and it still doesn't work, try using the IP and port directly instead.
-
You don't have to think much to see how public variables can be integrated into Lua OOP: people_address = {} function Person(name, address) local self = {} local person_name = name people_address[self] = address function self.getName() return person_name end function self.getAddress() return people_address[self] end return self end That will give you a public variable per instance just by indexing the people_address table accordingly.
-
Currently there are no public resources I know about which replicate GTA: SA story missions in MTA: SA. However, with the exception of cutscenes, it is possible to script everything that GTA: SA has in singleplayer, and that includes missions.
-
Let's say that you for example like the animation WEAPON_sniper, inside the SNIPER block (which, by the way, doesn't allow the player to move while playing). You can't make the player arms go up and down as the player aims up or down, but you can use setElementRotation to make the player face a certain direction: if he aims north, rotate the ped north; if he aims south, rotate the ped south, and so on.
-
Expanding what Noki already said, these are some interesting results from that operator that, at a first glance, might seem against common sense: 0/0 ~= 0/0 -- true math.huge ~= math.huge -- false