Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 01/02/21 in all areas

  1. You have the most optimized way of creating the teams. But this code teams = createTeam is wrong, as you are overriding the teams variable as you are iterating over that list. The 1st one gets created, the second should fail because that teams variable just changed for the team entity you created in the 1st iteration of the loop. You can also write it like this (by using unpack): for k, v in ipairs( teams ) do createTeam( unpack(v) ) -- unpack can be used here because it is in the same order end but it's less optimized (if this is not a time critical code, then it will just save you time writing the code, but not by much either :p)
    1 point
  2. E aí novamente. Presumindo que você tenha "criado um botão", funções DX não são tratadas da mesma forma que GUI. Em DX, você deve usar o evento onClientClick, onde ele recebe alguns parâmetros, sendo os dois primeiros o lado do botão que foi clicado (left, right; esquerda, direita) e o estado, que eu recomendo a você usar o up, em cliques casuais. Aqui um exemplo de uso: Off-topic: evite criar mais um tópico sobre o mesmo assunto, você poderia ter usado este tópico para comentar a sua dúvida. ?
    1 point
  3. 1 point
  4. Well you need to store the player in a variable. function teszt() local wep = getPedWeapon(source) local targetPlayer = source if isPedOnFire(source) and wep == 24 then toggleControl(source, "fire", false) setTimer(function() toggleControl(targetPlayer, "fire", true) end, 5000, 1) end end addEventHandler("onPlayerWeaponFire",root,teszt) Now it should work fine.
    1 point
  5. Pode continuar a usar o VSCode normal. Esses vídeos, inicialmente, saíram para uma outra plataforma e fazia sentido usar VSCodium lá. Mas, caso ainda queira usar o VSCodium, você precisa baixar o arquivo da extensão e instalar pelo menu Install from VSIX. Link da extensão: https://github.com/Subtixx/vscode-mtalua/releases/download/2.4.0/mtasa-lua-2.4.0.vsix
    1 point
  6. Hmm, I have no idea. Maybe it takes the size of the vehicle in consideration. You can improve your distance check with https://wiki.multitheftauto.com/wiki/GetDistanceBetweenPoints3D
    1 point
  7. Hi. Okay, so there are 3 problems with your code, what I can see now. 1) You have to use every dxDraw... functions inside a render event (onClientRender), because when you call these functions, the image visible only for 1 frame. 2) On client-side 3rd parameter of addEventHandler is missing, the attached function. 3) On server-side your triggerClientEvent is bad, because now you send this trigger to every(!) clients, you have the define "sendTo" parameter, it's root (everyone) by default. Should look something like this: -- CLIENT function phoneRender() dxDrawImage(540, 290, 281, 512, "images/phone.png") end function openPhone() addEventHandler("onClientRender", root, phoneRender) end addEvent("openPhone", true) addEventHandler("openPhone", root, openPhone) -- how to stop render: function closePhone() removeEventHandler("onClientRender", root, phoneRender) end -- SERVER -- only the trigger -- send this trigger only to "player", who entered the command triggerClientEvent(player, "openPhone", root) Here you can read about events: https://forum.multitheftauto.com/topic/114541-tut-events/
    1 point
  8. Deu problema, pois o source nesse evento seria o veiculo, não o player. addEventHandler("onVehicleDamage",root,function() local player = getVehicleOccupant(source) -- / Pegou o player que está dentro daquele veiculo, caso não tenha um player ele retornaria false if player then -- / Vi se encontrou um player naquele veiculo, para caso caso ele retorne um valor boolean if getElementData(player,"ModoPassivo") then -- vi se o player que está dentro do carro está com esse elementdata cancelEvent() -- se estiver ele vai cancelar o evento. end end end Utilize no Server-Side !!
    1 point
  9. It looks like something has happened during copying the font to the cache(server or client). ? You could try to convert the font to OTF format. (there are websites that can convert fonts)
    1 point
  10. https://forum.sa-roleplay.net/viewtopic.php?f=73&t=29 4.5k+ views Our latest Staff Team update: https://forum.sa-roleplay.net/viewtopic.php?f=14&t=245 Making us 24 people total in SA-RP staff team as of writing this post!
    1 point
  11. This function can give you the position of the door: https://wiki.multitheftauto.com/wiki/GetVehicleComponentPosition (use the example functions to figure out the door component names) Keep in mind that the door can fall off, might be handy to define the positions inside of a static table. And this function can be used to compare the distance between you and the door: https://wiki.multitheftauto.com/wiki/GetDistanceBetweenPoints3D
    1 point
  12. You need to create custom smoke Check it here: https://github.com/alcoholiclobster/drift-paradise-mta https://github.com/alcoholiclobster/drift-paradise-mta/blob/1bc6b1bf6520b1818c54b7fb9b75f97f9b290e69/[core]/dpVehicles/client/tyres_smoke.lua
    1 point
  13. Here's another method as well: Let's say that your dxDrawText looks just like you want it to on a screen resolution of 1440x900. You can use the following way to make it ok on any resolution: local sx_, sy_ = guiGetScreenSize() local sx, sy = sx_/1440, sy_/900 dxDrawText("$123456789", 140*sx, 648*sy, 0*sx, 0*sy, tocolor(0,0,0,255), 0.8*sy,"bankgothic") Now a bit of an explanation on how it works. So you made the text look fine on 1440x900, nice. When you made your text function to look ok on 1440x900 it will look like this: dxDrawText("$123456789", 140, 648, 0, 0, tocolor(0,0,0,255), 0.8,"bankgothic") Now all you do is multiply each value by the "sx" and "sy" you just calculated at the top of the script. This way the position of the text will move accordingly with the resolution. This means that if the text is below the radar on 1440x900 and you use this way then on 1920x1080, 1366x768, 1280x720, etc the text will always be in the same spot, below the radar. And always remember to multiply the scale of the text by the "sy" variable to make it smaller on small resolutions and bigger on big ones. This is just an alternative way to the method which @Hale provided. There's no performance drawbacks or anything to this, use whichever seems easier for you. Hope we help others as I remember I had huge problems with this when I was still new to LUA and drawing stuff on screen .
    1 point
  14. addEventHandler("onClientMarkerHit", root, MKH_OPEN) If you bind this event handler to the local player instead addEventHandler("onClientMarkerHit", localPlayer, MKH_OPEN) The GUI should only open when you hit the marker.
    0 points
×
×
  • Create New...