Jump to content

Search the Community

Showing results for tags 'onclientrender'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Multi Theft Auto: San Andreas 1.x
    • Support for MTA:SA 1.x
    • User Guides
    • Open Source Contributors
    • Suggestions
    • Ban appeals
  • General MTA
    • News
    • Media
    • Site/Forum/Discord/Mantis/Wiki related
    • MTA Chat
    • Other languages
  • MTA Community
    • Scripting
    • Maps
    • Resources
    • Other Creations & GTA modding
    • Competitive gameplay
    • Servers
  • Other
    • General
    • Multi Theft Auto 0.5r2
    • Third party GTA mods
  • Archive
    • Archived Items
    • Trash

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


About Me


Member Title


Gang


Location


Occupation


Interests

Found 7 results

  1. --// by iManGaaX (Youssef Maged). isWindowShowing = false --متغير بالقيمة false عشان نعرف البوتن ظاهر او لا local screenW, screenH = guiGetScreenSize() function renderDx() dxDrawRectangle(screenW * 0.2844, screenH * 0.4644, screenW * 0.0919, screenH * 0.0378, tocolor(0, 0, 0, 100), false) --رستنقل علي شكل زر dxDrawText("Test button", screenW * 0.2844, screenH * 0.4644, screenW * 0.3762, screenH * 0.5022, tocolor(255, 255, 255, 255), 1.00, "default", "center", "center", false, false, false, false, false) --داخل الرستنقل تيكست end --نقفل الفنكشن --// لما يضغط على اف9 يظهر البوتن function onKey(theButton, theState) if theButton == "F9" and theState == true and isWindowShowing == false then --لو ضغط على اف 9 والمتغير قيمته false بمعنى الزر حالياً مخفي showCursor(true) --اظهار الماوس isWindowShowing = true --نعطي المتغير قيمه true بمعنى الزر ظاهر حالياً addEventHandler("onClientRender", getRootElement(), renderDx) --نظهر الزر الآن elseif theButton == "F9" and theState == true and isWindowShowing == true then --لو ضغط اف 9 ولاكن المتغير قيمته true بمعنى الزر ظاهر حالياً showCursor(false) --نخفى الشات isWindowShowing = false --نعطى المتغير قيمه false بمعنى الزر انحذف الآن removeEventHandler("onClientRender", getRootElement(), renderDx) --نحذف الزر الآن end --نقفل التحقق end --نقفل الفنكشن addEventHandler("onClientKey", getRootElement(), onKey) --// لما يضغط على الرستنقل (البوتن) function onClick(theButton, theState) --ملاحظه: بتحط تحت فالكود isMouseInPosition بين القوسين أحدثيات الرستنقل وليس التيكست.. if theButton == "left" and theState == "down" and isWindowShowing == true and isMouseInPosition(screenW * 0.2844, screenH * 0.4644, screenW * 0.0919, screenH * 0.0378) then --لو ضغط كلك يسار فى الماوس واللوحة ظاهره حالياً (بنعرف عن طريق المتغير) والماوس على الرستنقل اللي هو البوتن outputChatBox("test") --اظهار فالشات تيست end --نقفل التحقق end --نقفل الفنكشن addEventHandler("onClientClick", getRootElement(), onClick) --// هنا يوسفيل فنكشن للتحق إذا كان الماوس على البوتن (لا تعدل فيه شئ) function isMouseInPosition(x, y, width, height) if(not isCursorShowing()) then return false end local sx, sy = guiGetScreenSize() local cx, cy = getCursorPosition() local cx, cy =(cxsx),(cysy) if (cx >= x and cx <= x + width) and (cy >= y and cy <= y + height) then return true else return false end end --// أتمنى الشرح واضح وبسيط, شكراً.
  2. Estou usando onClientRender para aparecer um dxDrawText em meu painel , pois ele mostra um valor do server-side. Com isto , ao abrir o painel , esse texto não para de piscar(trazendo o valor varias vezes), mas se eu usar addCommandHandler ele aparece apenas um vez. Gostaria de manter o texto em meu painel , apenas removendo ele ao utilizar removeEventHandler para fechar o painel.
  3. Render events enchanting 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:
  4. Eae pessoal. Estou com uma dúvida rápida aqui. Estou fazendo um sistema de level, nesse sistema existe um verificador server-side que verifica todos os jogadores a cada 1 segundo procurando por players AFK para pausar o Up do level. Até então sem problemas, mas estou querendo colocar o tempo do up de cada jogador aparecer na tela deles, qual procedimento a seguir é MAIS LEVE para fazer isso? cria uma variável, salva o tempo nela e triggerClientEvent a cada 1 segundo, para enviar essa variável atualizada ao cliente. setElementData no jogador a cada 1 segundo, então o client irá sempre mostrar essa data na tela dele. setAccountData no jogador a cada 1 segundo. [Já vi que é inviável fazer assim, até porque não há como receber esse valor client-side] fazer o próprio client calcular o tempo de up? A propósito, o timer em si é este: (server-side) No script client, deverá ter um onClientRender que deverá mostrar o playerLapsed ao jogador. (só que no client, irá formatar os milisegundos em minutos/segundos.)
  5. Galera, fiz esse script para resolver um problema solicitado por um usuário aqui do fórum. O objetivo é fazer com que os jogadores e veículos que estiverem dentro de uma zona de colisão fiquem no "modo ghost" (sem colisão) para que os veículos e jogadores que estiverem dentro da zona não colidam entre si e voltem ao normal quando saírem da zona. O esquema é simples de se fazer usando setElementCollidableWith e onClientColShapeHit. O problema é que os veículos criados dentro da zona não eram afetados, pois ainda não existiam quando o jogador entrou na zona, sendo necessário o jogador sair da zona e entrar de novo nela para que este novo veículo fosse afetado também. Para contornar esse problema fiz tudo usando onClientRender, porém não sei se essa é a melhor maneira, levando em conta que consome maior processamento e existem muitos verificadores dentro dele. O script ficou assim: (client-side) Alguém tem alguma ideia de fazer esse script "mais leve"? Ou esse jeito é o único possível para evitar o problema?
  6. The text appears succesfully but i cant make it disappear:/ Pls help! [lua] function fadeDX() startTick = getTickCount() addEventHandler("onClientRender",root,text) end function text() local currentTick = getTickCount() local progress = (currentTick-startTick)/duration local alpha = interpolateBetween(0,0,0,255,0,0,progress,"InOutQuad") dxDrawText ( "D-Day", x/2.05, y/3, x, y, tocolor(255, 255, 255, alpha), 3) setTimer ( function() startTick = nil,nil removeEventHandler("onClientRender",root,text) local currentTick = getTickCount() local progress = (currentTick+startTick)/duration local alpha = interpolateBetween(0,0,0,255,0,0,progress,"InOutQuad") dxDrawText ( "D-Day", x/2.05, y/3, x, y, tocolor(255, 255, 255, alpha), 3) end, 8000, 1 ) end [/lua]
  7. Hi there. I interesting the one of important question. When I want to get getPedVehicleOccupied, what' will be more better with a performance side? To check every frame with onClientRender event if player are in a vehicle (getPedVehicleOccupied)? Or set events like a onClientVehicleEnter/Exit, onClientResourceStart etc. and check getPedVehicleOccupied only in those events?
×
×
  • Create New...