Jump to content

FernandoMTA

Members
  • Posts

    370
  • Joined

  • Last visited

  • Days Won

    23

Everything posted by FernandoMTA

  1. being able to play MTA from a VM and access only local servers could be interesting... This would facilitate the lives of developers when we need to test scripts in multiplayer but nobody is available to come help you out
  2. function changeM4Crosshair(thePlayer) if not getElementData(thePlayer, "zoom") then setWeaponProperty("m4", "pro", "flag_aim_1st_person", true) setWeaponProperty("m4", "std", "flag_aim_1st_person", true) setWeaponProperty("m4", "poor", "flag_aim_1st_person", true) setElementData(thePlayer, "zoom", true) outputChatBox("on", thePlayer, 0,255,0) else setWeaponProperty("m4", "pro", "flag_aim_1st_person", false) setWeaponProperty("m4", "std", "flag_aim_1st_person", false) setWeaponProperty("m4", "poor", "flag_aim_1st_person", false) removeElementData(thePlayer, "zoom") outputChatBox("off", thePlayer, 255,255,0) end end addCommandHandler("mira", changeM4Crosshair, false, false) @copo se eu bem entendi, quando vc dá esse comando ele ativa o modo mirar em 1ª pessoa. Ao dar o comando outra vez, desativa. está bom assim ou você quer mais alguma coisa? Vejo que no seu print tem uma mira diferente (vermelha), isso ja faz parte de outro script q muda a crosshair por shader. EDIT: Eu me apercebi que isso n vai dar certo infelizmente pq o setWeaponProperty muda a propriedade da arma pro servidor todo, e não apenas para o player que você quer...
  3. 1. Quando é que a função fly que faz triggerClientEvent é chamada? 2. Se você adicionar um print no arquivo client.lua ele aparece na sua debugscript?
  4. Tem alguns erros de escrita no seu codigo. Verifique todas as linhas Mas para começar, isso aí não faz sentido Você poderia usar element data no jogador. if not getElementData(thePlayer, "zoom") then -- ativar setElementData(thePlayer, "zoom", true) else -- desativar removeElementData(thePlayer, "zoom") end Veja a wiki do MTA sobre as funcoes setElementData e getElementData, e setWeaponProperty tambem amigo @copo
  5. provavelmente seu meta.xml ta errado como você mostrou noutro post. Veja na consola do servidor se todos os scripts do resource foram carregados com sucesso.
  6. function irCarroProximo(thePlayer, cmd) -- checar permissao de staff aqui local x,y,z = getElementPosition(thePlayer) local int, dim = getElementInterior(thePlayer), getElementDimension(thePlayer) local closestVehicle = nil local smallestDistance = nil for k, vehicle in ipairs(getElementsByType("vehicle")) do local vx,vy,vz = getElementPosition(vehicle) local vint, vdim = getElementInterior(vehicle), getElementDimension(vehicle) -- verificar se tao no mesmo mundo if vint == int and vdim == dim then -- verificar se n tem ngm dentro if not getVehicleController(vehicle) then -- verificar posicao local dist = getDistanceBetweenPoints3D(x,y,z, vx,vy,vz) if (smallestDistance == nil) or (dist < smallestDistance) then smallestDistance = dist closestVehicle = vehicle end end end end if not closestVehicle then outputChatBox("Nenhum veículo desocupado foi encontrado", thePlayer, 255,0,0) return end local vx,vy,vz = getElementPosition(closestVehicle) setElementPosition(thePlayer, vx, vy, vz +3) outputChatBox("Teleportado para o veículo mais próximo#ffffff "..vx..", "..vy..", "..vz, thePlayer, 0,255,0, true) end addCommandHandler("ircarroproximo", irCarroProximo, false, false) se tiver alguma dúvida não hesite @SciptNovato
  7. @SciptNovato como ficaram os arquivos? Nesse ultimo print falta alguns ', olhe: Tem que ser: <script src="server_S.lua" type="server"/> <script src="client.lua" type="client" cache="false"/> de acordo com os nomes dos arquivos. E o min client version é assim q bota: <min_mta_version client="1.5.9-9.21118.0" server="1.5.9-9.21118.0"/> Pode botar um print("oi") no final de cada arquivo para ver na consola se eles foram carregados.
  8. @copo sobre o 1o script: o addCommandHandler parece bem. Quando a função abrir for executada por ele, vai tentar verificar "painel == false". Não faço ideia de onde vem essa variável, suponho que nunca foi declarada. Quando uma variável não existe, o valor dela é nil e não false. Logo você pode verificar "if painel == nil then" ou "if not painel then". Aí ele vai adicionar o onClientRender. E quando for fazer o comando novamente para esconder o painel, a variável vai estar a true como você setou, então vai executar o que vem depois do "else", removendo assim o onClientRender. Sobre o 2o script: Você estava quase, mude esse "if exibir_bulssola = false then" para "if not exibir_bussola then" (bussola ta mal escrito e também faltava um = na comparação) Sobre o 3o script: N faço ideia o que você está tentando fazer. Essa função apenas seta algumas propriedades de arma sempre que é chamada. Você teria que mudar isso
  9. No worries. You can always change the SPAZ properties serverside to improve the weapon
  10. Eu testei o seu código e realmente não estava acontecendo nada ao entrar no marker, então eu mudei: local entrarInterior = createMarker(2231.294921875,-2414.8959960938,12.65, "cylinder", 1, 255, 255, 255, 50) function entrarLocal(thePlayer, matchingDimension) if (getElementType(thePlayer) == "player") and (matchingDimension) and (not getPedOccupiedVehicle(thePlayer)) then setElementPosition(thePlayer, 941.87628173828, 2115.2114257812, 1011.0302734375) setElementInterior(thePlayer, 1) end end addEventHandler("onMarkerHit", entrarInterior, entrarLocal) - Coloquei getPedOccupiedVehicle em vez de isPedInVehicle pois essa função está obsoleta - adicionei matchingDimension que é um argumento do onMarkerHit - botei o event handler no marker mesmo, em vez de root + verificar o source depois - aumentei ligeiramente a coordenada Z do marker: de 12.54 para 12.65 e passou a funcionar. Realmente o marker estava muito para baixo e não estava detetando o player. Espero ter ajudado @SciptNovato
  11. Esse script é de tipo "server" no meta.xml, certo? Pois o evento onMarkerHit é serverside. Para clientside seria onClientMarkerHit. @SciptNovato
  12. I don't think u need to modify ACL often. Either way, you have many ACL functions to try: https://wiki.multitheftauto.com/wiki/AclGroupAddObject
  13. float leftX, float topY [, float rightX = leftX, float bottomY = topY It uses those arguments for positioning so that you can determine the 4 points of a rectangle in which the text will be. Default alignment is horizontal "left" and vertical "top". You can easily change this to "center", "center" to place your text in the middle of the rectangle you defined with the 4 left, top, right, bottom points. Idk why they didn't just do x,y, width,height but it works like this.
  14. @RaxzenThe wiki says: Custom weapons are weapons you create with https://wiki.multitheftauto.com/wiki/CreateWeapon that can't be held by a player/ped, and are in the world. What you would be looking for is a clientside version of this to set weapon ID properties for the client only, and not the whole server: ... but sadly it doesn't exist. There are some suggestions related to weapon properties, skill levels, etc in the Bug tracker here, which you can explore. I remember seeing a suggestion saying that setWeaponProperty should be able to take a player argument so it only applies to a certain player. I wish this was implemented already
  15. You coud do something like this in a client script: local DAMAGE_AREA = createColPolygon(-1, 4, 5, 8, 9, 4, 5, -2, -1, 4) -- colshape coordinates here local DAMAGE_DELAY = 3000 -- miliseconds between damage hits local DAMAGE_AMOUNT = 5 -- health points to lose local damageTimer local function takeDamage() -- cancel damage timer if dead if isPedDead(localPlayer) then if isTimer(damageTimer) then killTimer(damageTimer) damageTimer = nil end return end -- take damage (this may kill the player) setElementHealth(localPlayer, math.max(0, getElementHealth(localPlayer) - DAMAGE_AMOUNT)) outputChatBox("Ouch", 255, 56, 56) -- you can trigger some visual effects here (if you want) end addEventHandler( "onClientColShapeHit", DAMAGE_AREA, function (theElement, matchingDimension) if (theElement ~= localPlayer) then return end if not (matchingDimension) then return end -- take damage instantly (if you want) takeDamage() -- set damage timer damageTimer = setTimer(takeDamage, DAMAGE_DELAY, 0) end) addEventHandler( "onClientColShapeLeave", DAMAGE_AREA, function (theElement, matchingDimension) if (theElement ~= localPlayer) then return end if not (matchingDimension) then return end -- cancel damage timer if isTimer(damageTimer) then killTimer(damageTimer) damageTimer = nil end end)
  16. Like PUBG outside the safe zone where the player takes damage slowly?
  17. Hi! Very interesting, it definitely sounds useful. Do you know any practical applications of this module so far?
  18. I never heard of this issue. Can u provide screenshots, and what scripts u have running in your server? You can try seeking help in MTA Discord maybe that will be faster.
  19. Eu aconselho colocar apenas 1 único recurso para iniciar automaticamente com o servidor. Esse mesmo recurso vai iniciar todos os recursos que você precisar com startResource. Eu acho que isto permite mais controlo e verificações de eventuais erros ou problemas com os recursos do servidor.
  20. Change will only happen if people ask for it or someone decides to do it out of own will. I don't know if there's need to upgrade Lua version entirely. I know new functions & features can be added directly when needed. You can stay up to date with MTA Development:
  21. I think the Ban Appeals section should be excluded from the forum's default activity stream (recent posts) for the following reasons: - Global MTA ban appeals are only intended to be handled by MTA staff. Regular users shouldn't comment on them. - New ban appeals are posted almost every day, several times a day and seem to be happening more and more frequently. - A lot of appeal attempts are invalid and end up getting a reply by a moderator & locked quickly. - Many of the posts are in another language, and generally not interesting for anyone who is not staff to read through. - Hiding Ban Appeal posts from the recent posts stream will give more exposure to other interesting posts like Resource showcases or Looking for help posts. - Forum feed will feel less spammed. Yay or nay?
  22. MTA uses Lua 5.1 https://github.com/multitheftauto/mtasa-blue/tree/master/vendor/lua (correct me if I'm wrong). Features from more recent Lua versions won't work in your MTA Lua client/server scripts. For example, the goto statement was only added in Lua 5.2 http://lua-users.org/wiki/GotoStatement
  23. @greenops011 I checked and that screenshot_path coreconfig.XML setting is not used. Always defaults to the MTA installation directory / screenshots. You can open a feature request here if you think the user should be able to customize screenshots path.
  24. The 2 most common ways of interacting with other resource scripts is: - calling exported functions like: exports.resourceName:functionName or exports["resourceName"]:functionName - calling events, you should look for which were added in other resources: triggerEvent, triggerServerEvent, etc
×
×
  • Create New...