Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 16/05/19 in Posts

  1. 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
  2. Slipe is an open source framework that enables anyone to write scripts for MTA:San Andreas in C# instead of Lua, wrapping all MTA elements and classes and including some .NET Core namespaces. It is based on CSharp.Lua by Yang Huan. Slipe features: Runs on Windows and Linux Built in continuous deployment support with (GitHub) webhooks Object oriented wrappers for all MTA elements Async/await for MTA functions that use callbacks C# style Http requests, sockets and XML methods. Use Visual Studio and its Intellisense Type safety You can find more information about the project on https://prod.mta-slipe.com. Our Discord Our Github The project is still in Alpha, and since it is open source anyone is welcome to contribute
    1 point
  3. @JustP استخدم زر التبليغ عن المشاركات المخالفة بدلاً من المنشن مستقبلاً
    1 point
  4. Well there's no standards for scripting, there's only logic and basic. However asking here if the script is good isn't going to help you, test the script in MTA server. If it has bugs, fix them or send them here and we will help~
    1 point
  5. الله يهديك ماتشوف الشرح فوق تقول وظيفتها تكنسل بس
    1 point
  6. Place that code into the event where the first button is clicked (make sure you put it after checking if the button clicked is the button you're looking for)
    1 point
  7. I solved this question, thanks for the answers.
    1 point
  8. Oops, this is what you want here. if source == bv2 then if ( DGS:dgsCheckBoxGetSelected(v12) == true ) and ( DGS:dgsCheckBoxGetSelected(v14) == true ) then window5 = DGS:dgsCreateWindow((sw-424)/2,(sh-363)/2,400,200,"+",false) elseif ( DGS:dgsCheckBoxGetSelected(v12) ~= true ) and ( DGS:dgsCheckBoxGetSelected(v14) ~= true )then window6 = DGS:dgsCreateWindow((sw-424)/2,(sh-363)/2,400,200,"-",false) end end
    1 point
  9. 1 point
  10. You can use table.sort for sorting, but first you have to extract the data you want from the table and place it in another to make it iterable. For instance: local sorted = {} for itemId, itemData in pairs(myItems) do table.insert(sorted, itemId) -- extract item ids end -- sort the items table.sort(sorted, function(a, b) return a < b end) iprint(sorted) You can also sort it by the item count local sorted = {} for itemId, itemData in pairs(myItems) do table.insert(sorted, itemData) -- extract the item data instead end table.sort(sorted, function(a, b) return a.count < b.count end) As you can see you can extract any data from your tables and sort them however you like.
    1 point
  11. wind = dgsCreateWindow(0.2*sW,0,0.4*sW,0.4*sH,"Example Scroll Pane (exclude this window)",false) pane = dgsCreateScrollPane(20,0,200,200,false,wind) dgsScrollPaneSetScrollBarState(pane,false) scrollbar = dgsCreateScrollBar(0,0,20,180,false,false,wind) dgsSetProperty(scrollbar,"theScrollPane",pane) dgsSetProperty(scrollbar,"functions",[[ local scb = dgsScrollPaneGetScrollBar(dgsElementData[self].theScrollPane)[1] dgsElementData[self].multiplier = dgsElementData[scb].multiplier dgsElementData[self].length = dgsElementData[scb].length ]]) addEventHandler("onDgsScrollPaneScroll",pane,function(vertical) dgsScrollBarSetScrollPosition(scrollbar,vertical) end) addEventHandler("onDgsScrollBarScrollPositionChange",scrollbar,function(value) local scbs = dgsScrollPaneGetScrollBar(pane) dgsScrollBarSetScrollPosition(scbs[1],value) end) gdlt = dgsCreateImage(0.5,0,1.1,1.1,_,true,pane,tocolor(255,255,255,255)) gdlt2 = dgsCreateImage(0.1,0,0.7,0.7,_,true,pane,tocolor(0,255,255,255)) With the latest DGS, this is an example to handle your situation.
    1 point
  12. a Sim pois lá eles usaram "onClientClick", Só não sei como eles fizeram utlizar em um veiculo especifico.
    1 point
  13. É só você definir a janela como invisível assim que você cria ela: wnd = guiCreateWindow(497, 145, 301, 423, "Mudança de clima e tempo", false) guiSetVisible(wnd,false) Ah, agora que vi... tira aquele showCursor(true) da linha 18 também, se não irá aparecer o cursor do mouse (quando o script iniciar) sem a janela estar aberta!
    1 point
  14. Yes u can but you need : 3DSmax + Scripts + Experience. If you have .obj and texture is really easy to convert ( after training ). I have make a bit tutorial how convert .obj .tga to .dff .txd If u need help i can.
    1 point
  15. ReShade and ENB cause more errors that anything else, especially with MTA shaders and i got a lot of false-complaints because players used ENB and were surprised that their game bugged on my server thanks to the custom d3d9.dll...
    0 points
×
×
  • Create New...