Jump to content

[M]ister

Members
  • Posts

    444
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by [M]ister

  1. Ensina Aew todos querem saber Existe várias formas de se fazer isto, você pode fazer uma verificação, se ela for verdadeira o script funciona, caso ao contrário não. Você pode verificar se o nome do server é tal; se existe uma certa conta no server; se o IP do server bate com o que você definiu, entre outros...
  2. Também existe comandos nativos para essas ações: Apenas para staffs: /chgpass Para players: /chgmypass
  3. Olá pessoal, eu estou com uma dúvida, eu preciso criar um script no qual resolva uma expressão matemática, ex: 10+50/2*10, eu criei um que apenas realiza uma conta, ex: 10/2, e então queria saber como possa criar tal script que suporte realizar a conta com vários operadores e valores em uma string? Obs: ¹Também é preciso que seja mantido a ordem dos operadores para realizar as contas (multiplicação/divisão antes de adição/subtração) ²Não posso utilizar eventos
  4. Copie o código novamente, é que as variáveis: screenW e screenH eram locais da função playerZoom, dai deu erro quando tentei chama-las em outra função.
  5. Tente: function playerZoom (key,keyState) screenW, screenH = guiGetScreenSize() if (key == "n") then if (getElementData(getLocalPlayer(),"Night Vision Goggles") > 0) then if nightvision then nightvision = false setPedAnimation(getLocalPlayer()) setCameraGoggleEffect("normal") removeEventHandler("onClientRender", root, image) else nightvision = true addEventHandler("onClientRender", root, image) setTimer(setPedAnimation, 150, 1,getLocalPlayer(),"goggles","goggles_put_on",650,true,false,false,false) setTimer(setCameraGoggleEffect, 700, 1, "nightvision") end end elseif (key == "i") then if (getElementData(getLocalPlayer(),"Infrared Goggles") > 0) then if infaredvision then infaredvision = false setPedAnimation(getLocalPlayer()) setCameraGoggleEffect("normal") removeEventHandler("onClientRender", root, image) else infaredvision = true addEventHandler("onClientRender", root, image) setTimer(setPedAnimation, 150, 1,getLocalPlayer(),"goggles","goggles_put_on",650,true,false,false,false) setTimer(setCameraGoggleEffect, 700, 1, "thermalvision") end end end end bindKey("n","down",playerZoom) bindKey("i","up",playerZoom) function image() dxDrawImage(screenW * 0.0000, screenH * 0.0000, screenW * 1.0000, screenH * 1.0000, "IMAGE.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) end
  6. - O certo seria utilizar o evento onPlayerLogin, pois no onPlayerJoin o player não está logado, então não há como verificar se ele está no grupo na acl. - Você também está atribuindo em uma variável uma função: ArmaEspecial = setWeaponProperty(24, "pro", "flag_type_dual", true). - Modo correto: setWeaponProperty(24, "pro", "flag_type_dual", true). - Acredito que não dará para você alterar a propriedade da arma para alguns players em específico, pois ao executar essa função ela altera para todos. Olhei o modo cliente da função, mais não possui essa propriedade (flag_type_dual).
  7. Não há necessidade de criação de uma função para isto, basta utilizar o string.format: string.format("%.2d:%.2d:%.2d", getRealTime().hour,getRealTime().minute,getRealTime().second)
  8. Tá errado as linhas 4 e 7 do 1º script Linha 4: if daBlockz == "PAULNMCA" and daAnimz == "wank_in" then -- Não existe "PAULNMCA" o certo é "PAULNMAC". A função getPedAnimation() retorna a categoria e a animação em minúsculo então o certo seria utilizar "paulnmac". Linha 7: setPedAnimation ( source, "PAULNMCA", "dnce_m_b") -- Corrigir "PAULNMCA" por "PAULNMAC" declarar o "wank_in" no lugar do "dnce_m_b" Script correto: function punheta (source) daBlockz = getElementData(root,"blockz") daAnimz = getElementData(root,"animz") if daBlockz == "paulnmac" and daAnimz == "wank_in" then setPedAnimation(source,false) else setPedAnimation ( source, "PAULNMAC", "wank_in") end end addCommandHandler("punheta",punheta) E no 2º script não sei se você copiou errado, mais está ddEventHandler sendo que o correto é addEventHandler Script correto: addEventHandler("onClientPreRender",root, funcation () daBlock, daAnim = getPedAnimation(getLocalPlayer()) setElementData(root,"blockz",daBlock) setElementData(root,"animz",daAnim) end ) Esse script possui coisas desnecessárias, aqui um exemplo de um mais simples: -- lado cliente addCommandHandler("punheta", function() local category, anim = getPedAnimation(localPlayer) if category == "paulnmac" and anim == "wank_in" then setPedAnimation(localPlayer, false) else setPedAnimation(localPlayer, "paulnmac", "wank_in", -1, true, false) end end )
  9. The only way I found for not destroy the element when the music run out, was the following: sound = playSound("...") setSoundPaused(sound,true) function refresh() if getSoundPosition(sound)+1 < getSoundLength(sound) then if not isSoundPaused(sound) then setSoundPaused(sound,false) end else setSoundPaused(sound,true) removeEventHandler("onClientRender",root,refresh) end end -- example of use addCommandHandler("cmd",function(cmd,subcmd) if subcmd == "start" then addEventHandler("onClientRender",root,refresh) elseif subcmd == "restart" then setSoundPosition(sound,0) --addEventHandler("onClientRender",root,refresh) elseif subcmd == "stop" then removeEventHandler("onClientRender",root,refresh) setSoundPaused(sound,true) setSoundPosition(sound,0) end end) If you use in server side you can using setTimer for doing the checking
  10. Um modo para fazer isto é utilizar uma variável contadora, ex: cont=0 addCommandHandler("evento",function(source) setElementPosition (source, x, y+cont, z) -- Ai depende da rotação, ai vc vê se tem q add na coordenada x ou y, somar ou subtrair. cont=cont+2 -- '2' é um valor qualquer que significa a distância entre um player e outro. end)
  11. https://wiki.multitheftauto.com/wiki/WarpPedIntoVehicle
  12. Sinceramente eu não acredito que seja possivel mudar a posição do Chat e do Radar original.
  13. Use este, ou tente achar o erro no seu através dele: (testado) Marker = createMarker(x,y,z,"cylinder",size,red,green,blue,alpha) Armas = { {28,200}, -- 28 = Uzi | 200 = Munição {29,200}, {30,200}, {31,200}, } addEventHandler("onMarkerHit",Marker,function(hitElement) if getElementType(hitElement) == "player" then Money = getPlayerMoney(hitElement) if Money and Money >= 1000 then n = math.random(#Armas) takePlayerMoney(hitElement,1000) giveWeapon(hitElement,Armas[n][1],Armas[n][2]) outputChatBox("Arma "..getWeaponNameFromID(Armas[n][1]).." adquirida com sucesso por $1000!",hitElement,255,255,255,true) else outputChatBox("Você não possui $1000!",hitElement,255,0,0,true) end end end)
  14. addCommandHandler("gang", function(player,cmd,subcmd,newtag) if subcmd == "tag" then local xml = xmlLoadFile("gangs.xml") local children = xmlNodeGetChildren(xml) teams = {} for i,nodes in pairs(children) do teams[i] = xmlNodeGetAttribute(nodes,"name") teamName = getTeamName(getPlayerTeam(player)) outputChatBox("Team name in xml: "..teams[i].." Team name of player: "..teamName) if teams[i] == teamName then xmlNodeSetAttribute(nodes,"tag",newtag) --outputChatBox("You changed the tag") else --outputChatBox("Error") end end xmlSaveFile(xml) xmlUnloadFile(xml) end end)
  15. I had tried just with variables, but as the error persisted I decided to try several things '-'
  16. the 'Error' still continues to appear twice
  17. It changes the value of the 'tag' in XML, but prints the message 'Error' twice addCommandHandler("gang", function(player,cmd,subcmd,newtag) if subcmd == "tag" then local xml = xmlLoadFile("gangs.xml") local children = xmlNodeGetChildren(xml) teams = {} for i,nodes in pairs(children) do teams[i] = xmlNodeGetAttribute(nodes,"name") if teams[i] == getTeamName(getPlayerTeam(player)) then xmlNodeSetAttribute(nodes,"tag",newtag) else outputChatBox("Error") end end xmlSaveFile(xml) xmlUnloadFile(xml) end end)
  18. Hello I am creating a system for teams and plan to use xml to save data from gangs. But I'm having some difficulty using it and I would do the following: Well I'm in the team 'Gang1' and type in the command ex: '/ gang tag ' and with this he change the value 'tag' of the xml file . gangs.xml <teams> <team name="Gang1" tag="TAG1" color="#FF9e00"></team> <team name="Gang2" tag="TAG2" color="#00FF00"></team> <team name="Gang3" tag="TAG3" color="#777777"></team> </teams> script.lua addCommandHandler("gang", function(player,cmd,subcmd,newtag) if subcmd == "tag" then -- help me with code ? end end) Could anyone help me with this?
  19. Very thanks Bonsai, worked. addCommandHandler("text",function(player,command,...) text = table.concat ( { ... }, " " ) outputChatBox("Text: "..string.reverse(text)) end)
  20. Hello I wonder if there is some way in the Lua Language to convert a message backwards. Ex: I love MTA -> ATM evol I I would like to add it in this script: addCommandHandler("text",function(player,command,text) outputChatBox("Text: "..text) end)
  21. Yes. On line 358 of file dxList.lua: scrollbarVert = dxCreateScrollBar(cx+cw-22,cy,20,choc,getElementParent(component),"Vertical",0,200,cTheme)
  22. Hello I am using this dxgui: https://drive.google.com/folderview?id= ... sp=sharing. However when I want to make the list invisible the scrollbar continues, could someone help me? Image: dxList.lua File:
  23. I would like to ask another question. What the utility the function: guiAttachToDirectX, of the resource dxGui (https://forum.multitheftauto.com/viewtopic.php?f=108&t=43639) ? and any examples of use? I searched but found nothing
  24. Oh my god, I did not pay attention, had in the script: dxSetAlwaysOnTop (wnd, true). function which leaves the dx window in front Yet thanks Me4ever
×
×
  • Create New...