Jump to content

DNL291

Retired Staff
  • Posts

    3,875
  • Joined

  • Days Won

    67

Everything posted by DNL291

  1. Really helpful. Well done!
  2. DNL291

    ranks icon

    He can simply use dxDrawImage.
  3. De nada.
  4. You're welcome.
  5. Yes, you can also use it. I attached the onPlayerCommand event to the player that joined the server, because in this case, you can enable that command to the player again.
  6. onPlayerLogin is triggered when a player logs into their account. If you are not logged in, onPlayerLogin isn't triggered.
  7. Tinha um pequeno erro. Mude isso na linha 26: getVehicleEngineState(engineState[source]) Para: setVehicleEngineState(source, engineState[source])
  8. addEventHandler("onPlayerJoin", root, function () addEventHandler("onPlayerCommand", source, disableLoginCommand) end) function disableLoginCommand(command) if (command == "login") then cancelEvent() end end
  9. Veja se tem a função spawnPlayer depois que o jogador faz o login, se já tiver, o problema é outro. Se não tiver, você deve colocar.
  10. Fiz isso no meu último código, já testou ele?
  11. Se você não quer que outros jogadores controlem o veículo, você deve definir um dono, ou verificar se quem está dirigindo é o jogador que criou o veículo, com getElementSyncer. Não tenho certeza se é isso o que você quer. Tente isto: local engineState = {} function thisResourceStart () local players = getElementsByType ( "player" ) for _,this_player in ipairs(players) do bindKey ( this_player, "lctrl", "down", toggleEngine ) end end addEventHandler ("onResourceStart", resourceRoot, thisResourceStart) function toggleEngine ( player, key, state ) if getPedOccupiedVehicleSeat ( player ) == 0 then local vehicle = getPedOccupiedVehicle ( player ) setVehicleEngineState ( vehicle, not getVehicleEngineState ( vehicle ) ) engineState[vehicle] = getVehicleEngineState(vehicle) end end function playerJoined() bindKey ( source, "lctrl", "down", toggleEngine ) end addEventHandler("onPlayerJoin", root, playerJoined) addEventHandler("onVehicleEnter", root, function () if type(engineState[source]) == "boolean" then getVehicleEngineState(engineState[source]) end end) addEventHandler("onElementDestroy", root, function () if not getElementType(source) == "vehicle" then return end if type(engineState[source]) == "boolean" then engineState[source] = nil end end)
  12. Baixe o último patch do MTA:SA aqui e veja se isso resolve: https://nightly.multitheftauto.com/
  13. local marker=createMarker(2366.2221679688,1982.6693115234,10.8203125,"cylinder",2,0,0,255,255) createBlip(2366.2221679688,1982.6693115234,10.8203125,31) function Prop (player) if (isElementWithinMarker(player,marker)) then outputChatBox ( "#FF0000 [PROPRIEDADE]#FF8C00Para Comprar Esta propriedade Digite /comprar (Custa:25.000)", player, 0, 0, 0, true) local money = getPlayerMoney(player) if (money >= 25000) then takePlayerMoney(player, 25000) outputChatBox ( "#FF0000[PROPRIEDADE]#FF8C00Vc Compro A Propiedade Deposito Lv!", player, 0, 0, 0, true) end end end addCommandHandler("comprar",Prop) Você precisa armazenar o proprietário, para quando a casa for comprada, obter o antigo dono e dar o dinheiro para ele.
  14. Tente: function thisResourceStart () local players = getElementsByType ( "player" ) for _,this_player in ipairs(players) do bindKey ( this_player, "lctrl", "down", toggleEngine ) end end addEventHandler ("onResourceStart", resourceRoot, thisResourceStart) function toggleEngine ( player, key, state ) if getPedOccupiedVehicleSeat ( player ) == 0 then local vehicle = getPedOccupiedVehicle ( player ) setVehicleEngineState ( vehicle, not getVehicleEngineState ( vehicle ) ) end end function playerJoined() bindKey ( source, "lctrl", "down", toggleEngine ) end addEventHandler("onPlayerJoin", root, playerJoined)
  15. https://wiki.multitheftauto.com/wiki/Shader_examples#UV_scripted
  16. You're welcome.
  17. local team = createTeam("Admin",255,255,255) function setTeam(_, acc) if isObjectInACLGroup("user."..getAccountName(acc), aclGetGroup("Admin")) then setPlayerTeam(source, team) end end addEventHandler("onPlayerLogin",root, setTeam)
  18. Lembre-se sempre de colocar resourceRoot como elemento anexado ao evento onClientResourceStart/Stop, a menos que queira que o evento seja chamado quando qualquer resource for iniciado. E acredito que o Stanley quis colocar o evento onPlayerWasted no lado server, onde está onGetExp. O evento também está com os argumentos diferentes do evento onPlayerWasted. Os argumentos corretos são: totalAmmo, killer, killerWeapon, bodypart, stealth (parece que está com os argumentos do evento onPlayerDamage). Obs: use root, em vez de resourceRoot nesse caso (o mesmo serve para o evento onGetExp no lado client). E também, a função clientResourceStop, que destrói o elemento gui-progressBar será inútil, pois quando o resource for parado, automaticamente o elemento será destruído. Corrigi apenas para evitar que você tivesse erros posteriores com relação a isso, e como Stanley disse, o código não foi testado. Voltando ao foco do tópico, você pode usar um método de porcentagem para calcular o valor que será adicionado ao progressBar. Exemplo: Se a exp máxima for um valor de 450, e a exp que será acrescentada for 12, você deve fazer o seguinte para calcular a porcentagem que será acrescentada na barra de progresso: 12*100 /450 --> 2.66 Será um calculo mais exato e infalível. Eu uso o método de porcentagem para calcular diversas coisas.
  19. You're welcome.
  20. local textFont = "default-bold" local textScale = 1 local heightPadding = 1 local widthPadding = 1 local xOffset = 8 local minAlpha = 10 local textAlpha = 255 local rectangleColor = tocolor(0,0,0,145) local floor = math.floor local w,h = guiGetScreenSize() local function drawMapStuff() if isPlayerMapVisible() then local sx,sy,ex,ey = getPlayerMapBoundingBox() local mw,mh = ex-sx,sy-ey local cx,cy = (sx+ex)/2,(sy+ey)/2 local ppuX,ppuY = mw/6000,mh/6000 local fontHeight = dxGetFontHeight(textScale,textFont) local yOffset = fontHeight/2 local blips = getElementsByType("blip") for k,v in ipairs(blips) do local attached=getElementAttachedTo(v) if isElement(attached) and getElementType(attached)=="player" then local px,py = getElementPosition(attached) local x = floor(cx+px*ppuX+xOffset) local y = floor(cy+py*ppuY-yOffset) local pname = getPlayerName(attached) local pname2 = getPlayerName(attached):gsub("#%x%x%x%x%x%x", "") local nameLength = dxGetTextWidth(pname2,textScale,textFont) local r,g,b = getPlayerNametagColor(attached) local _,_,_,a = getBlipColor(v) if a>minAlpha then dxDrawRectangle(x-widthPadding,y+heightPadding,nameLength+widthPadding*2,fontHeight-heightPadding*1,rectangleColor,false) dxDrawText(pname2,x+1,y+1,x+nameLength,y+fontHeight,tocolor(0,0,0,255),textScale,textFont,"left","top",false,false,false,true) dxDrawText(pname,x,y,x+nameLength,y+fontHeight,tocolor(r,g,b),textScale,textFont,"left","top",false,false,false,true) end end end end end addEventHandler("onClientRender",getRootElement(),drawMapStuff) Is that what do you meant?
  21. Yes.
  22. DNL291

    Blip

    No, just change the name of the setBlipColor function. It's a bug with [ lua ][ / lua ] tag.
  23. Yes it is. Then, use executeCommandHandler on the server-side.
  24. DNL291

    Blip

    setBlipColor already is a MTA function. Also, the source of the onResourceStart event isn't a player element.
×
×
  • Create New...