Jump to content

_Ace

Members
  • Posts

    67
  • Joined

  • Last visited

  • Days Won

    1

_Ace last won the day on March 2 2020

_Ace had the most liked content!

1 Follower

Recent Profile Visitors

566 profile views

_Ace's Achievements

Snitch

Snitch (10/54)

40

Reputation

  1. yes getWorldFromScreenPosition just above player head, and processLineOfSight should do, fill the params with player for start coords and a bit of offset (like 1 or 2 meters) to evade the ray hitting the player itself, and getWorldFromScreenPosition for end coord, you can customize others params to your needs. something like: local wordx,worldy,worldz=getWorldFromScreenPosition(... local hitornot,hitx,hity,hitz=processLineOfSight(playerx,playery,playerz,worldx,worldy,worldz)
  2. function testp() valor={ [581] = 10000, [468] = 20000, [461] = 30000, [521] = 30000, [586] = 80000, [522] = 120000, --e outros ids } v=getPedOccupiedVehicle(localPlayer)--v é o veiculo a ter o preço checado, aqui to usando o veiculo que o player esta for veiculo in pairs(valor) do if v and veiculo==getElementModel(v) then outputChatBox("valor desse veiculo: "..valor[getElementModel(v)]/5) end end end addCommandHandler("testepreco",testp)
  3. esse objeto ja ta no mta/gta id: 1570 createObject(1570, 0, 0, 5)--meio do mapa
  4. _Ace

    Button

    Button = guiCreateButton(0.45, 0.54, 0.10, 0.06, "Get Value", true) guiSetProperty(Button, "NormalTextColour", "FFAAAAAA") guiSetVisible(Button, false) EditBox= guiCreateEdit(0.41, 0.45, 0.18, 0.04, " chcesz tego kupić sztuk?", true) guiSetProperty(EditBox, "NormalTextColour", "FFFF0000") guiSetVisible(EditBox, false) addEventHandler("onClientGUIClick", Button, function() local inputBox = tonumber(guiGetText(EditBox))--I think the idea was to set max 3 (count) to the edit? if tonumber(guiGetText(EditBox)) and tonumber(guiGetText(EditBox))<=3 then outputChatBox("U set value input "..inputBox, 255, 255, 0)--if input text was 3 or less else return outputChatBox("input > 3 or not number", 255, 255, 0) end end) -- Another Client Side addCommandHandler("TurnOnButton", function() guiSetVisible(Button, true) guiSetVisible(EditBox, true) showCursor(true)--showCursor(false) to disable mouse end)
  5. --clientside: addEventHandler("onClientVehicleEnter", getRootElement(), function() for i=2,5 do setVehicleDoorState(source,i,0) end end )
  6. @Arantes estranho pq eu testei com 2 players, e funcionou perfeito, unica coisa diferente foi que inseri o nome por comando e nao por painel, mas seria o mesmo ja que passa como texto tbm, pra testar vc pode inserir no chat como outputChatBox os dados e ver onde ta o problema: function haveOtherNick (myName) outputChatBox("funcao haveothernick recebeu: "..myName.." de player: "..getPlayerName(client)) for i, player in ipairs (getElementsByType("player")) do outputChatBox("for leu o checknick: "..getElementData (player, "checknick").." de "..getPlayerName(player)) if player~=client and (getElementData (player, "checknick") and getElementData (player, "checknick") == myName) then return true--se todos os players exceto eu não tem elementdata checknick igual a myName end end return false end function checkNick() local nome = getElementData (client, "checknick") outputChatBox("funcao checknick: leu elementdata: "..nome.." de "..getPlayerName(client)) if (nome) then if (haveOtherNick(nome)) then outputChatBox ("Já tem alguém com esse nome online.") removeElementData(client,"checknick")--opcional: remover o elementdata de quem nao foi aprovado pra nao ocupar o checknick em 2+ players else triggerClientEvent("successNick", getRootElement()) setElementData(client, "playername", nome) end end end addEvent("checkNick", true) addEventHandler("checkNick", getRootElement(), checkNick) e nessas funções de account data deu algum erro ou warning? e no caso esse sistema de nick que vc ta fazendo seria um nome secundario? pq vc poderia usar direto o getPlayerName pra checar nick/nome
  7. haveOtherNick sempre retorna true pq ele ta passando o for em todos os players, inclusive o proprio que acabou de setar o nick em si mesmo, pra comparar vc precisa excluir o player que deu trigger, antes faz essa alteração de source pra client, na wiki diz o seguinte: Atenção: vc deve usar a variavel global client no serverside ao invés de passar localPlayer ou por parametro ou source, Senão falsificação de evento (passar outro player invés de localPlayer) poderia ser possível (triggerServerEvent) ps: essa alteração source pra client é só no server, o script client fica igual tava o script server ficaria assim: function haveOtherNick (myName) for i, player in ipairs (getElementsByType("player")) do if player~=client and (getElementData (player, "checknick") and getElementData (player, "checknick") == myName) then return true--se todos os players exceto eu não tem elementdata checknick igual a myName end end return false end function checkNick() local nome = getElementData (client, "checknick") if (nome) then if (haveOtherNick(nome)) then outputChatBox ("Já tem alguém com esse nome online.") removeElementData(client,"checknick")--opcional: remover o elementdata de quem nao foi aprovado pra nao ocupar o checknick em 2+ players else triggerClientEvent("successNick", getRootElement()) setElementData(client, "playername", nome) end end end addEvent("checkNick", true) addEventHandler("checkNick", getRootElement(), checkNick)
  8. I answered a similar question before: I edited one line from the original code (from the wiki) dxDrawMaterialLine3D(x, y, z+1+height-(distanceBetweenPoints/distance*width)-1+width, x, y, z+height, Image, width-(distanceBetweenPoints/distance*width), tocolor(R or 255, G or 255, B or 255, alpha or 255)) so the width parameter works as scale, this code is tested and works fine to change the size of the image, if you need non uniform height change you can use the same line with some edits
  9. source é usado pra eventos dai não tenho certeza se pode gerar algum problema outra coisa são os triggerServerEvent com elemento localPlayer, geralmente se usa resourceRoot, verifique isso tbm pra ver se tem algum warning/erro no debugscript 3 quanto a solução vc pode usar o setElementData com flag no proprio player/assaltante, quando inicia o assalto deixa como true e qnd termina poe false, quando o cara quiser acionar a animação verifica se ele tem a elementdata e se tiver cancela con return, deixei um codigo que nao testei mas deve estar td ok, comentei pra ficar mais facil ver onde editei --CLIENT function animcruzabraco () if getElementData(localPlayer,"assaltando") then--checagem se o player tem elementdata assaltando, se tiver é cancelado outputChatBox("teste= animação impedida por elementdata") return end if getElementData ( localPlayer, "cruzabracodt" ) == false then setElementData(localPlayer, "cruzabracodt", true) setElementFrozen ( localPlayer, true ) triggerServerEvent("animcruzabraco",localPlayer)--verifique else setElementFrozen ( localPlayer, false ) setElementData(localPlayer, "cruzabracodt", false) triggerServerEvent("paraanim",localPlayer)--verifique end end bindKey("b", "both", animcruzabraco) --- --SERVER function sistema1(player)--coloquei player pq nao tenho certezz sobre usar source if player then if isElementWithinMarker(player, loja1) then local weaponType = getPedWeapon ( player ) if weaponType == 0 then outputChatBox ( "#727272Você está desarmado. #464646Tenha uma arma para assaltar.", player, 255, 255, 255, true ) else outputChatBox(" ", player, 255, 255, 255, true) outputChatBox("#cf3f3fINDFO: #e2e2e2Você está começando a roubar o banco Caixa #727272(Aguarde 4 minutos ou será punido). #e41c1cAs autoridades estão vindo.", player, 255, 255, 255, true) outputChatBox(" ", player, 255, 255, 255, true) setElementVisibleTo( loja1ass, root, true) setElementFrozen( player, true ) setElementData(player,"assaltando",true)-- aqui dou elementdata assaltando para o player, proibido de usar animacao b setPedAnimation( player, "bomber", "bom_plant_loop", 240000, true, false, false, false ) setMarkerSize(loja1, 0) outputChatBox(" ", player, 255, 255, 255, true) outputChatBox("#cf3f3fINFO: #e41c1cAtenção todas as autoridades. #e2e2e2O banco Caixa está sendo assaltado, compareçam ao local urgentemente!", root, 255, 255, 255, true) outputChatBox(" ", player, 255, 255, 255, true) setTimer(function(player) givePlayerMoney(player, GranaBanco)--GranaBanco nao ta definida na codigo do post verifique se esta no seu codigo inteiro setElementFrozen( player, false ) setPlayerWantedLevel( player, 6 ) outputChatBox("#cf3f3fINFO: #e41c1cVocê assaltou o banco Caixa e ganhou R$ "..GranaBanco, player, 255, 255, 255, true) setElementData(player,"assaltando",false)-- aqui tiro elementdata assaltando do player, liberado pra usar animação b end,240000,1,player) setTimer(function(player) setMarkerSize(loja1, 2.5) setElementVisibleTo( loja1ass, root, false) end,1800000,1,player) end end end end addCommandHandler("roubar", sistema1)
  10. no mesmo momento que tira o dinheiro, ja pode fazer o pagamento: function setMoneyOnWasted (_, killer ) local money = getPlayerMoney(source) local perde = money/10 if getElementType( killer ) ~= "player" or ( killer == source ) then cancelEvent() else if (money <=0) then cancelEvent() else takePlayerMoney ( source, perde ) if killer~=source then givePlayerMoney ( killer, perde ) end end end end addEventHandler ( "onPlayerWasted", getRootElement(), setMoneyOnWasted )
  11. use onPlayerWasted (serverside) ja que ta alterando o dinheiro, pro evento onplayerwasted o killer é o segundo parametro: --server function setMoneyOnWasted (_, killer ) local money = getPlayerMoney(source) local perde = money/10 if getElementType( killer ) ~= "player" then cancelEvent() else if (money <=0) then cancelEvent() else takePlayerMoney ( source, perde ) end end end addEventHandler ( "onPlayerWasted", getRootElement(), setMoneyOnWasted ) testado e funcionando
  12. dei uma ajeitada no código e comentei pra ficar melhor de entender, testei e agora ta funcionando e spawneando o vehiculo e o outro marker destroi normal, verifique se o resource infobox ta funcionando quando testar, aqui nao usei infobox. *a função getplayerfrompartialname nao vi uso Spawn = createMarker(197.93676757813, 1875.7465820313, 17.648057937622 -1,"cylinder", 1.9, 255, 140, 0, 99) Destroy = createMarker(174.04705810547, 2021.0935058594, 21.667898178101 -2,"cylinder", 5.0, 128, 0, 0, 99) veh = {} function spawnhl (elemento)--os parametros que vc usou sao pra comando, aqui vamos usar elemento = o elemento que encostou no marker if getElementType(elemento)=="player" then--verifica se é player e nao veiculo etc que chegou no marker, pra evitar msg de erro if veh[elemento] and isElement( veh[elemento] ) then destroyElement ( veh[elemento] ) veh[elemento] = nil end local accName = getAccountName ( getPlayerAccount ( elemento ) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ("EB") ) then--verifique na acl se existe grupo EB e se tem algum user.conta veh[elemento] = createVehicle(479, 162.86917114258, 2007.6252441406, 21.667898178101, -0, 0, 0.93193572759628)--ta saindo carro inves de helicoptero, verifica id warpPedIntoVehicle (elemento, veh[elemento] ) exports._infobox:addNotification(elemento, "#FFFF00Você pegou o Helicóptero da EB!!!", "success") --outputChatBox("Você pegou o Helicóptero da EB!!!",elemento)--outputchatbox pra teste = testado ok else exports._infobox:addNotification(elemento, "#FF0000Você não é da EB para pegar esse VEÍCULO!", "error") --outputChatBox("Você não é da EB para pegar esse VEÍCULO!",elemento) end end end addEventHandler("onMarkerHit", Spawn, spawnhl) function destroyvtr (elemento) if getElementType(elemento)=="player" then if veh[elemento] and isElement(veh[elemento]) then destroyElement (veh[elemento]) exports._infobox:addNotification(elemento, "#FFFF00Você destruiu o Helicóptero da EB!!!", "success") --outputChatBox("Você destruiu o Helicóptero da EB!!!") end end end addEventHandler("onMarkerHit", Destroy, destroyvtr)
  13. tem alguns erros no codigo, eu coloquei os comentarios dentro do codigo pra vc ver onde foi alterado: --server markerotas = createMarker(784.80267, -1345.52063, 12.54122, "cylinder", 1.5, 255,58,45, 50) --por ser um comando não vamos usar source e sim uma variavel function openpnl (jogador)--vc precisa por o primeiro parametro aqui para o player que usou o comando, no caso to usando jogador pra vc entender if isElementWithinMarker (jogador, markerotas) then if getElementData (jogador, "Jornal") ==true then--esse ==true é desnecessario, mas se quiser pode deixar como ta triggerClientEvent(jogador,"abrirotas", getRootElement(), jogador)--jogador ali no começo, senao vai abrir o painel ou o que tenha no evento pra todos no sv else outputChatBox("Você não trabalha aqui ainda, vá para uma agência de empregos", jogador) end end end addCommandHandler("rotas", openpnl) -- --CLIENT function rotaspnl() --COMANDOS DO PAINEL DX end function openrotas () rotasbtn() addEventHandler("onClientRender", root, rotaspnl) showCursor(true) end addEvent("abrirotas", true) addEventHandler("abrirotas", root, openrotas)--faltou isso, é pra ativar a função openrotas não tem a função do painel dx no seu codigo, mas no teste que fiz a função rotaspnl é chamada então deve funcionar *ps ali na linha 9 no triggerclientevent, deixei o ultimo 'jogador', esta sendo passado como parametro pro evento do client, deixe pq não sei se vc vai usar depois
  14. first try setOcclusionsEnabled if doesnt work use: engineSetModelLODDistance(object id, distance visible) this is client side. if the object you are using dont have a lod (some objects dont have lod), you will need to create one and place in the same position/ attach it to the original, use the same object, same scale, and the last argument true, (to set as the lod) set it to setLowLODElement and then use engineSetModelLODDistance too
  15. yes it is possible but the player needs to be kinda close to the area, like 600mts/units, for the collision data to load and processLineofSight or getGroundPosition to work, you can do a loop and wait for some player to be near and then trigger the function, I made a test code clientside, you can use it from far away and close to the area to see how it works: --clientside createColCuboid(-2846.07104, -1545.08484, 137.68427, 64.902099609375, 53.124267578125, 4.56259765625) function cub() math.randomseed(getTickCount()) setTimer(function() local x=-2846.07104+math.random(64)--position random from x local y=-1545.08484+math.random(53)--position random from y local h, hx, hy, hz,_,_,_,_,_,_,_,model=processLineOfSight(x,y,150,x,y,130,_,_,_,_,_,_,_,_,_,true)--check for ground position and world model if not h then return outputChatBox("player too far")--if player is too far stop execution elseif model~=18306 then cub()--if randomizer hit the house or trees try again until hit the ground return end createObject(1238,hx,hy,hz+0.4) outputChatBox("obj created in: "..hx.." "..hy.." "..hz) end,100,1)--litle delay to randomizer end addCommandHandler("cuboid",cub) you can adapt this concept to work serverside using triggers / elementdata / tables if needed
×
×
  • Create New...