Leaderboard


Popular Content

Showing content with the highest reputation on 22/02/19 in all areas

  1. 2 points
    É uma opção pessoal. Prefiro usar onMarkerHit pois você pode já anexar o marker neste evento, acho que facilitaria pra ele e deixaria mais otimizado. Já no onPlayerMarkerHit não é possível anexar um marker, você tem que adicionar o evento como root e, dentro do evento, verificar os marcadores.
  2. 2 points
    Isso é feito através de shaders. Basicamente, você precisa criar texturas de pele, rosto, cabelo, camisas, calças, tênis etc e aplicar no CJ. Daí você poderá facilmente alterar a roupa, pele, cabelo, apenas aplicando shaders.
  3. 2 points
    يمكن انا فهمته خطأ , بس هو قال يبغى يحذف ( اي ) رقم فيه رقم 4 104 114 4 404 41 48 .........etc
  4. 2 points
    @!#DesTroyeR_,) function getPlayerInfo ( Player , Type ) if ( isElement ( Player ) ) and ( getElementType ( Player ) == 'player' ) then local Table = { [ 'Name' ] = getPlayerName ( Player ) , [ 'Serial' ] = getPlayerSerial ( Player ) , [ 'Money' ] = getPlayerMoney ( Player ) , [ 'TeamName' ] = getPlayerTeam ( Player ) and getTeamName ( getPlayerTeam ( Player ) ) or '' } if ( not Table [ Type ] ) then return false end return Table [ Type ] end end
  5. 1 point
    Events tutorial The reason why I created this topic, is that a lot of people are struckeling with them. In this tutorial I will only discus the very basic of them. If you want more, then there is a list of links at the end with more information. If I made any mistakes in the code, please let me know because I am not going to test every part. What are events? (basic description) Events are something custom added by MTA to make it easier to bring scripting(lua) closer to our game. If we do not have events, then the only thing we can do is give instructions to our game. But our code will never detect changes in our game. The same question again: "So what are the events?" Events are a way to communicate changes in our game to our scripts (or from our scripts). So for example my little ped(cat) gets ran over by a car. Then I really want to know about that, don't I? When an event activates, I describe this as: triggered (from the word trigger) Full wiki information can be found here: Event_system Before we can use events, what do we need to know? There are two things we need to know: The reason why it is triggered. <What happens?/when something happens?> In MTA this is the eventName of the event. (Example: you <ran over> my ped) Who is the one using the event? The event system in MTA is using elements as base (baseElement). This makes it easier to combine the what/when happens? with the one who is related to it. In MTA this is the source of the event. (Example: you ran over my <ped>) Trigger an event A scripting example: (this is not an official event) local ped = createPed( 120, 5540.6654, 1020.55122, 1240.545 ) -- my ped triggerEvent("onPedRanOver", ped) In this example, a custom event gets triggered to tell you that my new created ped has been ranOver. The eventName is "ranOver" and the baseElement is ped. local ped = createPed( 120, 5540.6654, 1020.55122, 1240.545 ) -- my ped local drunkDriver = getRandomPlayer() triggerEvent("onPedRanOver", ped, drunkDriver) In this SERVERSIDE example, I am also adding an extra argument drunkDriver to use the player that ran over the ped. This is not required, but it makes it more complete. See syntax. Syntax bool triggerEvent ( string eventName, element baseElement, [ var argument1, ... ] ) TriggerEvent Receiving triggers Receiving triggers is a bit more complicated, because there are a lot of options for it. You can receive events by listening to them. It is like: You know that something is going to happen but you do not know when. The first step that you have to take is related to this question: "Do I want to receive a custom or not custom event?" Custom events are self created events. They only exist when a scripter makes them. Two lists of NOT CUSTOM EVENTS but default MTA events, serverside and clientside: Server_Scripting_Events Client_Scripting_Events Do I want to receive a CUSTOM event? In case of a custom event, you have to register/enable it first. If you do not enable it and trigger it, you will receive a warning/error about that in your debug console. Syntax bool addEvent ( string eventName [, bool allowRemoteTrigger = false ] ) AddEvent The example below, shows you how to enable a custom event only for trigger events within the same server/client side. addEvent("eventName") -- Is the same as: addEvent("eventName", false) If you put the second argument to false or not fill it in, this means that you can't communicate from the other server/client-side. This option is most likely used for security reasons. Some events shouldn't be able to trigger by the other side For example, worst case scenario: (remote events enabled for a default MTA event) Serverside code: addEvent("onPlayerWasted", true) Clientside code: triggerServerEvent("onPlayerWasted", player, 0, localPlayer, 0, 9, false) OnPlayerWasted If this event is enabled for remote trigger events, then it might be possible to cheating kills/deaths score. Of course, it is not likely that players can run their own clientside code, but it is not impossible in case of not trust able community resources. Enable a custom event for trigger events that crossing sides (From clientside to serverside. From serverside to clientside). addEvent("eventName", true) This event can now be used by remote trigger event functions. See list: Client to server TriggerClientEvent TriggerLatentClientEvent Server to client TriggerServerEvent TriggerLatentServerEvent Enable the event from our previous example: addEvent("onPedRanOver", false) local ped = createPed( 120, 5540.6654, 1020.55122, 1240.545 ) -- my ped local drunkDriver = getRandomPlayer() triggerEvent("onPedRanOver", ped, drunkDriver) If you do not use cross triggering, then I recommend to use the addEvent function in the same resource as where you are going to trigger from. This makes sure that the event is already added and that you will never receive this kind of error/warning "Event isn't added". If you put it in another resource which hasn't started yet, then after triggering you would still receive that error/warning. Start listening The next step is to add the addEventHandler. This function is used to listen to events. When an event is triggered, this handler(addEventHandler) will call the function you have attached to it, in MTA this function is called the handlerFunction. Syntax bool addEventHandler ( string eventName, element attachedTo, function handlerFunction [, bool getPropagated = true, string priority = "normal" ] ) AddEventHandler Resource 1 addEvent("onPedRanOver", false) local ped = createPed( 120, 5540.6654, 1020.55122, 1240.545 ) -- my ped local drunkDriver = getRandomPlayer() triggerEvent("onPedRanOver", ped, drunkDriver) Resource 2 function handlerFunction () end addEventHandler("onPedRanOver", root, handlerFunction) The first 3 arguments, the require ones: eventName attachedTo handlerFunction Making sure that the addEventHandler options are correct set-up. Resource 1 addEvent("onPedRanOver", false) local ped = createPed( 120, 5540.6654, 1020.55122, 1240.545 ) -- my ped local drunkDriver = getRandomPlayer() triggerEvent("onPedRanOver", ped, drunkDriver) Resource 2 function handlerFunction () end addEventHandler("onPedRanOver", root, handlerFunction) There are two conditions for an eventHandler to call the handlerFunction. 1. The event has to be exactly the same. In this case the event "onPedRanOver" is the same in both resources. 2. In both functions, triggerEvent and addEventHandler is an element being used. This element has to be exactly the same. (from where you trigger as well as where you receive) <OR> The triggered element from resource 1, has to be a CHILD of the element in resource 2. The root element is the very top layer of the MTA element structure. It will accept all elements you want to use for your events. See the element tree: If you do not understand the element tree please read this page: Element_tree Source variable The source of an event is the element that triggers the event. This variable isn't passed as an parameter, but it is predefined. This means that it is already created before hand. Some predefined variables do only exist under special conditions. The source variable is one of those, it is a hidden and local variable which is only available when a function is called by an event. List of predefined variables. addEvent("onPedRanOver", false) -- local ped = createPed( 120, 5540.6654, 1020.55122, 1240.545 ) -- my ped local drunkDriver = getRandomPlayer() triggerEvent("onPedRanOver", ped, drunkDriver) function handlerFunction (drunkDriver) iprint(source) -- ped element end addEventHandler("onPedRanOver", resourceRoot, handlerFunction) In this example the ped is the source. See how those two code blocks are connected: addEvent("onPedRanOver", false) -- local ped = createPed( 120, 5540.6654, 1020.55122, 1240.545 ) -- my ped local drunkDriver = getRandomPlayer() triggerEvent("onPedRanOver", ped, drunkDriver) function handlerFunction (drunkDriver) iprint(source) -- ped element end addEventHandler("onPedRanOver", resourceRoot , handlerFunction) resourceRoot In some examples, you see people use the resourceRoot instead of the root element for their addEventHandlers. The resourceRoot is an element created by a resource. This element holds all elements of that resource as (in)direct children. In the example above, the resourceRoot as baseElement will not work, because there are two resources. Each resource has it's own resourceRoot element. The resourceRoot is accessible with the same keyword: resourceRoot, but if you were to inspect the element in multiple resources, then the user data (element identifier) value is not the same. outputChatBox(inspect(resourceRoot)) If we were to put everything in one resource, then it would work: 🎉 addEvent("onPedRanOver", false) -- function handlerFunction () end addEventHandler("onPedRanOver", resourceRoot, handlerFunction) -- local ped = createPed( 120, 5540.6654, 1020.55122, 1240.545 ) -- my ped local drunkDriver = getRandomPlayer() triggerEvent("onPedRanOver", ped, drunkDriver) In case of remote triggering, the resourceRoot in serverside and clientside is considered the same.(As long as they are part of the same resource) Why/when would we use resourceRoot? 1. Limit eventHandlers to the resource elements If you have 1000 markers in your server. One of the resources is for example a trucker mission, where you can get money by hitting markers. The resourceRoot element will make sure that the onMarkerHit event will only trigger for markers created by that resource. addEventHandler("onMarkerHit", resourceRoot, function () -- source element is the marker end) OnMarkerHit 2. Another benefit is that you are able to re-use the same eventNames. Resource 1 addEvent("onPedRanOver", false) function handlerFunction () end addEventHandler("onPedRanOver", resourceRoot, handlerFunction) -- local ped = createPed( 120, 5540.6654, 1020.55122, 1240.545 ) -- my ped local drunkDriver = getRandomPlayer() triggerEvent("onPedRanOver", ped, drunkDriver) Resource 2 addEvent("onPedRanOver", false) function handlerFunction () end addEventHandler("onPedRanOver", resourceRoot, handlerFunction) -- local ped = createPed( 120, 5540.6654, 1020.55122, 1240.545 ) -- my ped local drunkDriver = getRandomPlayer() triggerEvent("onPedRanOver", ped, drunkDriver) These two resources do use the same event, but will not trigger each other their addEventHandlers. Warning: If root was used, then they will!!!! ;@ Lets cross triggering with resourceRoot! Clientside triggerServerEvent("example", resourceRoot) Serverside addEvent("example", true) -- second argument is true! cross triggering enabled! addEventHandler("example", resourceRoot, function () end) getPropagated In this bigger example we will be talking about the option getPropagated. If this option is disabled, it will not detect children any more. Keep reading! After that start code scanning from A, to B and then to C. Syntax addEventHandler bool addEventHandler ( string eventName, element attachedTo, function handlerFunction [, bool getPropagated = true, string priority = "normal" ] ) Example: Clientside -- A triggerServerEvent("onClientPlayerLoaded", resourceRoot) -- trigger an event to serverside --------------------------------------- -- C addEvent("onResponseServer", true) -- first listener addEventHandler("onResponseServer", resourceRoot, function () outputChatBox("getPropagated enabled") end, true) -- getPropagated true by default. -- second listener addEventHandler("onResponseServer", resourceRoot, function () outputChatBox("getPropagated disabled") end, false) -- getPropagated is false. Serverside -- B addEvent("onClientPlayerLoaded", true) -- second argument is true! cross triggering enabled! addEventHandler("onClientPlayerLoaded", resourceRoot, function () --[[ client is a predefined variable, which represents the client/player that communicates with the server More information about predefined variables: https://forum.mtasa.com/topic/33407-list-of-predefined-variables/ ]] triggerClientEvent(client, "onResponseServer", resourceRoot) -- first trigger event local element = createElement("randomElement") -- making a randomElement triggerClientEvent(client, "onResponseServer", element) -- second trigger event end) How does this this code works? A. When a client his code has been started, it will execute a triggerServerEvent. (It doesn't wait for any other clientside files to be loaded) B. The server receives the event. And sends two triggerClientEvents back: The first one is using the resourceRoot as baseElement. The second one is using a randomElement as baseElement. Both are using the event "onResponseServer" C. There are two addEventHandlers listening to the event: "onResponseServer" The first one is using getPropagated and the second one is not using getPropagated. The randomElement that is created, is by default an indirect child of the resourceRoot of the same resource. What will happen? When firing the first trigger event, both listeners will call their handlerFunction. But when firing the second trigger event, only the first listener will call it's handlerFunction. The randomElement is an indirect child of resourceRoot, but because getPropagated is disabled it will not call it's handlerFunction. Other tutorials related to this one: See also this tutorial about deeper limiting event ranges within your resource and reducing addEventHandlers https://forum.mtasa.com/topic/100069-tut-addeventhandler-on-a-group-of-elements-small-tutorial/ More information Full wiki information: Event_system A list of more information about triggering events: (Client to client / server to server) TriggerEvent Client to server TriggerClientEvent TriggerLatentClientEvent Server to client TriggerServerEvent TriggerLatentServerEvent A list of more information about receiving events: AddEvent AddEventHandler RemoveEventHandler Two lists of MTA events, serverside and clientside: (warning: not custom events) Server_Scripting_Events Client_Scripting_Events Cancel events CancelEvent WasEventCancelled (warning: custom events ONLY) GetCancelReason (Server only) Cancel latent events and their status GetLatentEventHandles CancelLatentEvent GetLatentEventStatus
  6. 1 point
    Na verdade da para alterar o shader de skins sem ser do CJ. Exemplo: client-side: addCommandHandler( "vestir", function( cmd ) local shader = dxCreateShader( "shader.fx", 0, 0, true, "ped" ) engineApplyShaderToWorldTexture( shader, "suit", localPlayer ) dxSetShaderValue( shader, "gTexture", texture ) outputChatBox( "Roupa vestida!" ) end ) shader.fx texture gTexture; technique TexReplace { pass P0 { Texture[0] = gTexture; } }
  7. 1 point
    المشرف يتجاوب مع البلاغات أحسن من المنشن, انا ماعندي صلاحيات بقسم آخرغير العربي لذلك المنشن حقك ماله فائدة استخدم زر التبليغ ايضاً انت قاعد تشوه شكل الموضوع بالرد حقك
  8. 1 point
    Quando a função for chamada, um novo tempo será definido. Pelo o que eu vejo na sua tabela: 5, 10, 15 ou 20 minutos. Opcional. Não irá fazer muita diferença neste caso.
  9. 1 point
    Explique o porquê disto. A diferença entre as funções. Sim. Todas as variáveis locais receberão novos valores.
  10. 1 point
    Aha! Então não errei. Que "bom".
  11. 1 point
    Você colocou pra destruir "rndPos", sendo que rndPos é uma variável que tá armazenando posições. Tente substituir por isso: if ( marker and isElement( marker ) ) then destroyElement( marker ); end if ( blip and isElement( blip ) ) then destroyElement( blip ); end if ( object and isElement( object ) ) then destroyElement( object ); end Também, retire a palavra local antes de marker, blip e object. Se eu fosse você, passaria a usar o evento onMarkerHit ao invés de onPlayerMarkerHit.
  12. 1 point
    Não. Como você sabe, basta converter skins do GTA pro MTA. O que eu disse é sobre personalizar o personagem. Vários tipos de pele, cabelo, tamanho do nariz, boca, olhos, seios, bunda, novas camisas, luvas e calças, esses itens em geral, isso sim é tudo no CJ, feito com shaders. O sistema é simples de fazer, mas criar esses modelos/texturas é bem complexo.
  13. 1 point
    Tenta usar upgrade all dai você já atualiza todos, use no console sem /
  14. 1 point
    Ele também mostra um comando que vc tem que usar para fazer atualização dos resources. Leia com atenção além dos erros. Se não me engano é o /upgrade <nomedoResource>
  15. 1 point
    Afaik from 0 to 1000. Because according to wiki 1000 enable dual weapons. https://wiki.multitheftauto.com/wiki/Weapon_skill_levels If you really want to know it for sure, then the obvious solution for a programmer is to debug it, isn't it? setPedStat(localPlayer, 21, 1000) iprint("super cow value:", getPedStat(localPlayer, 21))
  16. 1 point
  17. 1 point
    @!#DesTroyeR_,) what ??
  18. 1 point
    وانت من امتى تفهم
  19. 1 point
    هو يبي يوصلك ان بإمكانك اختصاره كذا وتزود المعلومات زي ماتبي انت هو يبي يوضح لك الفكره
  20. 1 point
    local AdminSerials = { ["dai"] = "D46516DC5E6FDDFF9D58BEF643086E42", ["x"] = "1D6F76CF8D7193792D13789849498452", ["test2"] = "D46516DC5E6FDDFF9D58BEF643086E42", ["test1"] = "1D6F76CF8D7193792D13789849498455" } addEventHandler("onPlayerLogin", root, function() local serial = getPlayerSerial( source ) local check = getAccountName(getPlayerAccount( source )) for k, v in pairs ( AdminSerials ) do if v == serial then outputChatBox("check 1 passed",getRootElement()) if k == check then adminName = getPlayerName( source ) outputChatBox("#000000[#FF0000Server#000000]#FF0000 Admin "..adminName.." #FF0000Has Logged In!",getRootElement(),nil,nil,nil,true) else cancelEvent( true,"unauthorised login!") end end outputChatBox("check 1 failed",getRootElement()) end outputChatBox("check 2 failed",getRootElement()) end
  21. 1 point
    Você pode deletar com esse código: addEventHandler( "onResourceStart", resourceRoot, function() for _,a in pairs(getAccounts()) do if removeAccount(a) then outputChatBox( "conta: "..tostring(getAccountName(a)).." removida", root, 230,230,230 ) else outputChatBox( "Erro ao remover conta: "..tostring(getAccountName(a)), root, 230, 30, 30 ) end end outputChatBox( "Total de contas: "..tostring(#getAccounts()), root, 142, 255, 142 ) end ) meta.xml: <meta> <script src="server.lua" /> </meta> Crie o arquivo server.lua e coloque o código Lua dentro; o mesmo com o meta.xml. Deixe os 2 arquivos numa pasta, mova para a pasta dos resources e depois dê o comando refresh e ligue-o. Lembre-se de adicionar o resource na acl. Abra o painel Admin > aba 'Resource' > clique em 'Manage ACL' > clique no grupo Admin e adicione o resource: resource.nome_do_resource. Você também pode resetar abrindo a internal.db. Se tiver pouco conhecimento em criar um resource, ligar, etc, te recomendo fazer isso.
  22. 1 point
    Uma observação: no evento onClientResourceStart troque root por resourceRoot com root a janela será criada quando qualquer resource do server for iniciado.
  23. 1 point
    local selectedResourceName = "" -- < fill in -- This function will be restarting a selected resource. local function restartSelectedResource (selectedResource) local resourceState = getResourceState(selectedResource) if resourceState == "running" then restartResource(selectedResource) elseif resourceState == "loaded" then startResource(selectedResource) end end addEventHandler("onResourceStart", resourceRoot, function () local selectedResource = getResourceFromName(selectedResourceName) if selectedResource then setTimer(restartSelectedResource, 600000, 0, selectedResource) else outputChatBox("Can't find the selected resource.") cancelEvent(true, "Can't find the selected resource.") end end) https://wiki.multitheftauto.com/wiki/SetTimer https://wiki.multitheftauto.com/wiki/OnResourceStart https://wiki.multitheftauto.com/wiki/GetResourceFromName https://wiki.multitheftauto.com/wiki/StartResource https://wiki.multitheftauto.com/wiki/RestartResource https://wiki.multitheftauto.com/wiki/GetResourceState https://wiki.multitheftauto.com/wiki/CancelEvent Make sure the resource has access to these functions <right name="function.startResource" access="true" /> <right name="function.restartResource" access="true" /> startResource restartResource Those functions are blocked by default because they are used for administration purposes. Step 1 The rights can be requested by the resource if you add these lines in to your meta.xml: <aclrequest> <right name="function.startResource" access="true" /> <right name="function.restartResource" access="true" /> </aclrequest> Step 2 Commands left to do: (fill in the <resourceName> of the resource that contains this script) /refreshall /aclrequest allow <resourceName> all
  24. 1 point
    اغلاق مجتمع العرب بشكل رسمي والسبب حاولنا اننا نبحر في عالم الانترنت ونستقطب جميع انواع الهوايات من القيمنق والبرمجة والتصميم وغيرها كان مجتمع العرب من افضل الاشياء اللي سويتها صراحه ومن انجح المشاريع لي شخصيا لكن للاسف فيه سببين غالبا هو السبب باغلاق مجتمع العرب اولا : انا وسترونق اصحاب مجتمع العرب , تقريبا الظروف ماساعدتنا اننا نطوره اكثر واكثر من الرغم اننا سوينا اشياء كثيرة وحاولنا نطلع مجتمع العرب لاجهزه الجوال وحاولنا نسوي منصه اجتماعية ولكن للاسف فشلنا ليس في البرمجة وانما الظروف هزمتنا , فحيث ان كلاً مننا له دراسته الخاصه وله اهتماماته ولقد بذل كل منا مجهود كبير جدا عشان نطلع مجتمع العرب مب بس في هالمنتدى حاولنا اكثر من مره سوينا تطبيقات سوينا الالعاب سوينا برامج سوينا مواقع سوينا استضافات سوينا متاجر وسوينا وسوينا ... الخ لكن لاتجري الرياح كما تشتهي السفن السبب الثاني غالبا يجي عدم اهتمام الناس فينا حاولنا اكثر من مره نسوي اشياء مفيدة ك مشروع سابق لنا وهو موقع للافلام والمسلسلات ومشروع مجتمع العرب بلس لكن للاسف مافي تفاعل يحمسنا اننا نسوي اكثر حتى بعد ماطلقنا المنتدى يرجل مافي احد سجل وغالبا هالشيء يجي من عدم اهتمام الاشخاص في جالسين نسويه , حاولنا ندعم افكاركم قلنا لكم عطونا افكاركم نعطيكم فلوس عطونا افكاركم نصف الربح بيكون لك سوينا مسابقات كثيرة وغالبا اكبر مسابقة في رمضان اللي راح , وللاسف تفاعل جدا ميت لذلك ردة الفعل بالنسبة لنا بتكون ميته ولكن حاولنا اكثر من مره اننا نطلع بشيء كويس , على سبيل المثال لعبه سبع ابواب واللي بالمناسبة هو مشروع حي جالسين نشتغل عليه , لكن بيطلع باسم غير مجتمع العرب عالعموم هالمشروع كان من المفترض انه يكون من اكبر المشاريع في مجتمع العرب ولكن للاسف مافي اي تفاعل , تقريبا بتقول معكم هالمشاريع وجاي تنشرها عندنا بمنتدى اللعبه ؟ غالبا ان هنا يوجد اصدقاء اعرفهم واريد اخذ ارائهم وتم نشر موضوع اللعبه في انداي قوقو اللي هي غالبا تدعم المشاريع وبرضو مافي اي اهتمام من المجتمع العربي ولا في اي اهتمام هنا , على سبيل المثال والله مافي احد تعب نفسه وجاني خاص ي خالد وش الفكرة وش بتسوون مافي اي اهتمام يرجل , لذلك قررنا اغلاق مجتمع العرب تحياتي . ادارة مجتمع العرب - خالد العمري - سترونق
  25. 1 point
    السلام عليكم ما هي المشكلة بهذا الكود ؟ addCommandHandler ( 'kick', function ( player ) local serial = getPlayerSerial ( player ); for ipairs( getElementsByType ( 'player' ) do if getPlayerSerial ( 59E507E419B1624DDA7F3278D00BDE54 ) == serial then return end kickPlayer ( 'تم طرد جميع اللاعبين لأسباب إدارية' ); end)
  26. 0 points
    Mesmo com o bone_attach, a roupa iria "atravessar" o personagem e não acompanhar os movimentos nem dobrar junto com ele.
  27. 0 points
    اقول نط خاص بس
  28. 0 points
    علي حسب ما فهمت منك ان انتا تبي تحذف رقم 4 لحالوا بدون ما تحذف رقم 4 من الارقام المركبة مثل 14 و 54 و الخ function removeNumberFromString( number , string ) local index1 , index2 , before , after index1 , index2 = string:find( number ) while index1 and index2 do before , after = string:sub(index1-1,index1-1),string:sub(index2+1,index2+1) if( tonumber( before ) == nil and tonumber( after ) == nil ) then string = string:gsub( string:sub( index1-1 , index2+1 ) , string:sub( index1-1 , index1-1 ) .. string:sub( index2+1 , index2+1 ) ) end index1 , index2 = string:find( number , index2+1 ) end return string end
  29. 0 points
    الشرف لي حبيبي
  30. 0 points
    ما اشتغل ولاكن .. يمكن ان تكون المشكلة من عندي شكرا للجميع