Leaderboard
Popular Content
Showing content with the highest reputation on 06/03/19 in all areas
-
Hi, we are looking for someone who can edit skin textures, this includes: feet, legs, torso, head / hair etc. This will be used for a character clothing system. Payment via Paypal. Contact me via PM in this forum if you are interested.2 points
-
Render events enhancement Having a lot of render events in your resource? Easier attach and remove? Or do you want to pass arguments in to a function which is attached to a render event? Then this might be something for you. Syntax: addRenderEvent bool addRenderEvent(function functionVar [, string eventName, arguments ...]) Arguments: The function you want to attach/target. The event you want to use. ( "onClientRender", "onClientPreRender", "onClientHUDRender") If you do not fill in one of these three, it will automatic fallback to "onClientRender". Fool proof. Arguments you can pass to the target function. (which isn't possible with the default addEventHandler + onClientRender function) Returns: true when added, and false otherwise. Syntax: removeRenderEvent bool removeRenderEvent(function functionVar [, string eventName]) Arguments: The function you want to attach/target. The event you want to use. ( "onClientRender", "onClientPreRender", "onClientHUDRender") If you do not fill in one of these three, it will automatic fallback to "onClientRender". Fool proof. Returns: true if found + removed, and false otherwise. (Not recommended to execute this function every frame > performance) onClientPreRender + timeslice If you use "onClientPreRender", just like the default event, it will pass the timeSlice to the attached/targetted function. https://wiki.multitheftauto.com/wiki/OnClientPreRender I am not sure if attached is the right word for this example, because it isn't really attached to the event. It is saved in a table which gets looped every frame. Performance Is this code bad for performance? The answer to that is NO. I ran a test for it, and it seems that addRenderEvent used less CPU AFTER adding the events. (addRenderEvent: 31% CPU, addEventHandler 99/100% CPU) Adding the event will probably use more CPU, but that is only one execution. Feel free to re-test this example, I am interested how it would perform on your pc's. Performance test code (Not the source code ) Source code:1 point
-
Bem, diante dessa situação, recomendo que você fale com o @ccw. Ele pode lhe ajudar.1 point
-
Há mais ou menos 2 anos, eu fiz um script que carrega os mods em segundo plano. Baixe: downloader Eu fiz algumas alterações para renomear o arquivo, veja o meta.xml para saber mais. @EDIT: Não altere o nome do resource. Mantenha "downloader".1 point
-
1 point
-
Não existe, teria que criar um script para isso. O problema não é checar se o arquivo existe, porque ele existe e já foi testado anteriormente com fileExists1 point
-
because the MTA developers decided to consider cancelled events as 'it never happened`. onPayerDamage is a delayed/streamed version of onClientPlayerDamage1 point
-
1 point
-
1 point
-
والله الفكرة بتكون حلوة لو يجتمعو اكثر من مبرمج مع بعض بس مشكلتها راح تصير مشاكل من وراها ف الافضل ما تصير1 point
-
1 point
-
1 point
-
Same results, without creating effect. Anyway it's solved, so i'll leave as it is. local x, y, z = reParseNumber(posX), reParseNumber(posY), reParseNumber(posZ) createEffect(effect, x, y, z, 0, 0, 0)1 point
-
1 point
-
Hmm indeed strange. And what if you re-parse it? function reParseNumber(number) return tonumber(tostring(number)) end1 point
-
1 point
-
@majqq Did you checked if those are actual numbers? (and not strings. In that case you wouldn't see the difference in the outputChatBox.) Also you do not need to use Vector3 in the second example, it can be filled in without. That will save you another function execution.1 point
-
Teste executado. Resultados: Detectei alguns problemas relacionados ao seu loop. Fiz algumas alterações e deixei comentários pelo código. Assim está funcionando perfeitamente: client.lua local replace_model = { -- Cada arquivo deve estar separado em linha diferente por causa da dupla verificação causada pelos loops. {"cmodels/tent.txd", "cmodels/6edp8dkehrk1sghEJD1cazP0rT8weF.txd", 3243}, {"cmodels/tent.dff", "cmodels/vvoabC2xENOoQhgpE9MvT8kHWsQXEl.dff", 3243} } function onStartResourceDeleteFiles() for _,data in ipairs(replace_model) do if not fileExists(data[2]) then -- Se não existe o arquivo renomeado, então: downloadFile(data[1]) -- Baixa o arquivo original do servidor. (pois lá ele não foi renomeado) elseif string.find (data[1], ".txd") then -- Senão se o arquivo renomeado é um TXD, então: engineImportTXD(engineLoadTXD(data[2]), data[3]) elseif string.find (data[1], ".dff") then -- Senão se o arquivo renomeado é um DFF, então: engineReplaceModel(engineLoadDFF(data[2]), data[3]) end end end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), onStartResourceDeleteFiles) addEventHandler("onClientFileDownloadComplete", getResourceRootElement(getThisResource()), function(file) -- Esta função é executada a cada arquivo baixado, no caso 2x for _, data in ipairs(replace_model) do if file == data[1] then -- Se o arquivo que acabou de ser baixado é o que está na data[1], então: fileRename(data[1], data[2]) -- Renomeia ele para o que está na data[2]. if string.find (data[2], ".txd") then -- Se o arquivo renomeado é um TXD, então: engineImportTXD(engineLoadTXD(data[2]), data[3]) -- Importa a textura no objeto cujo ID está no data[3] elseif string.find (data[2], ".dff") then -- Se o arquivo renomeado é um DFF, então: engineReplaceModel(engineLoadDFF(data[2]), data[3]) -- Aplica o modelo no objeto cujo ID está no data[3] end end end end) meta.xml <meta> <file src="cmodels/tent.txd" type="client" download="false"/> <file src="cmodels/tent.dff" type="client" download="false"/> <script src="client.lua" type="client" /> </meta> Arquivos após a execução:1 point
-
É a versão do nightly MTA, que foi lançada há 11 horas atrás.1 point
-
Tenho esse resource e funciona perfeitamente! porém o menu só aparece para que não tem os data : D13_RG_Nome, nascimento e etc.. Reloga e cria uma nova conta que vai aparecer.1 point
-
1 point
-
@Omar Aly server.lua Messages = { } addEventHandler( "onPlayerChat" , root , function( msg ) local localTime = '[ ' .. os.date("%d/%m/%Y") .. ' ] ' local plrName = '[ ' .. getPlayerName( source ) .. ' ] : ' local Show = localTime .. plrName .. msg table.insert( Messages , Show ) end ) function getMessages( ) if( #Messages > 0 ) then return Messages end return false end meta.xml <meta> <script src="client.lua" type="Client"/> <script src="server.lua" type="server"/> <export function="getMessages" http="true" /> </meta> php file <?php include( "mta_sdk.php" ); $mtaServer = new mta("serverHost", port , "account_username" , "account_password"); $resource = $mtaServer->getResource ("resourceName"); $Messages = $resource->call("getMessages")[0]; if( gettype( $Messages[0] ) == "NULL" ){ echo("there's no Messages Now !!"); } else{ for( $x = 0 ; $x < count( $Messages ) ; $x++ ){ echo( $Messages[$x] . "<br>" ); } } header("refresh: 3;"); ?> result : https://obliterated-repairs.000webhostapp.com/Test.php1 point
-
Lembro que tú tava com uma pasta do servidor e outra do cliente, você reinstalou qual ? deve ser a do cliente (ou ambas).1 point
-
شف قصة ان اكثر من مبرمج يسوو مع بعض ذي لحالها مشكلة لان بعض المبرمجين بيختلفو علي شي واحد وقصة انو اكثر من مبرمج يسوو مع بعض ما رح تنفع مثلا لو في مبرمج اقترح عليهم فكرة وفي منهم اتفق عليها وفي منهم ما اتفق او ما عجبته الفكرة طبعا راح تصير مشاكل لان منهم يبي يسوي الفكرة والباقي ما يبون ذي اول مشكلة ثاني مشكلة الزوار راح يتضايقون لو لقيو كثير من اصحاب السيرفر ثالث مشكلة لو في مبرمج سوا مشكلة مع البقية ممكن يهدد البقية مثلا كـ نشر موداتهم او يخرب شي بالسيرفر وكذا رابع مشكلة لو في واسطة بالسيرفر راح تصير مشاكل كثيرة مرة بين المبرمجين مثلا واحد خوي مبرمج من الي موجودين بالسيرفر وطلب رتبة منه وراح اعطاه طبعا في رح يوافق علي انه اعطاه رتبة وفي ما رح يوافق وبتصير مشكلة بسبب الواسطة وكذا وخامسا وسادسا إلخ في مشاكل لا تحصى بسبب هذا الموضوع1 point