Jump to content

main

Members
  • Posts

    112
  • Joined

  • Days Won

    1

Everything posted by main

  1. [ { "31": "4522", "29": "3000", "32": "1500" } ]
  2. @MaligNos Isso que estava precisando e não sabia como fazer! Na parte de incluir deu certo, porém na parte de remover não obtive sucesso O que tentei abaixo: addEvent ( "housing:removeWeaponHouse", true ) addEventHandler ( "housing:removeWeaponHouse", resourceRoot, function ( weaponID, ammo ) local houseName = playersInInterior [ client ] if houseName then local houseData = getHouseData( houseName, "houseWeapons" ) if houseData then local itens = fromJSON( houseData ) giveWeapon( client, weaponID, ammo, true ) itens [ weaponID ] = nil setHouseData ( houseName, "houseWeapons", toJSON ( itens ) ) triggerClientEvent( "housing:updateWeaponsManager", resourceRoot, getPedWeapons( client ), getHouseData( houseName, "houseWeapons" ) ) end end end )
  3. Olá pessoal, estou com uma dúvida de como posso fazer para inserir e retirar mais de 1 no painel de inventário da casa, pois só estou conseguindo fazer pra setar 1 arma. OBS: Estou setando na database em toJSON Imagem do painel para melhor entendimento do funcionamento: https://imgur.com/a/DNtKdpv addEvent ( "housing:addWeaponHouse", true ) addEventHandler ( "housing:addWeaponHouse", resourceRoot, function ( weaponID, ammo ) local houseName = playersInInterior [ client ] if houseName then local table = fromJSON( getHouseData( houseName, "houseWeapons" ) ) if table [ tostring( weaponID ) ] then return outputChatBox ( "Housing manager: Você já tem essa arma armazenada!", client, 255, 0, 0 ) end takeWeapon( client, weaponID ) setHouseData ( houseName, "houseWeapons", toJSON( setPedWeaponHouse( client, weaponID, ammo ) ) ) triggerClientEvent( "housing:updateWeaponsManager", resourceRoot, getPedWeapons( client ), getHouseData( houseName, "houseWeapons" ) ) end end ) addEvent ( "housing:removeWeaponHouse", true ) addEventHandler ( "housing:removeWeaponHouse", resourceRoot, function ( weaponID, ammo ) local houseName = playersInInterior [ client ] if houseName then giveWeapon( client, weaponID, ammo, true ) triggerClientEvent( "housing:updateWeaponsManager", resourceRoot, getPedWeapons( client ), getHouseData( houseName, "houseWeapons" ) ) end end ) function setPedWeaponHouse(ped, wep, ammo) local playerWeapons = {} if isElement(ped) and getElementType(ped) == "player" then playerWeapons[wep] = ammo else return false end return playerWeapons end function getPedWeapons(ped) local playerWeapons = {} if isElement(ped) and getElementType(ped) == "player" then for i=1,9 do local wep = getPedWeapon(ped,i) local ammo = getPedTotalAmmo(ped,i) if wep ~= 0 then playerWeapons[wep] = ammo end end else return false end return playerWeapons end
  4. Como é função útil, então necessita que você coloque isso dentro do seu código Em seguida, só utilizar a função: convertNumber(getElementData ( localPlayer, "Bank:Caixa" )) or 0
  5. Você pode usar esta função útil: convertNumber
  6. A função removeElementData é apenas server-side como mostra a wiki: Em vez disto, você pode usar setElementData(localPlayer, "abriu", false).
  7. local drawDistance = 7 g_StreamedInPlayers = {} function onClientRender() local cx, cy, cz, lx, ly, lz = getCameraMatrix() for k, player in pairs(g_StreamedInPlayers) do if isElement(player) and isElementStreamedIn(player) then local vx, vy, vz = getPedBonePosition(player, 4) local dist = getDistanceBetweenPoints3D(cx, cy, cz, vx, vy, vz) if dist < drawDistance and isLineOfSightClear(cx, cy, cz, vx, vy, vz, true, false, false) then local x, y = getScreenFromWorldPosition(vx, vy, vz + 0.3) if x and y then if getElementAlpha(player) > 0 then -- se o alpha do player for maior que 0 mostra o ID local ID = getElementData(player, "ID") or "N/A" local w = dxGetTextWidth(ID, 0.1, "default-bold") local h = dxGetFontHeight(1, "default-bold") dxDrawText(""..ID.."", x - 1 - w / 1, y - 1 - h - 12, w, h, CorTag, 1.20, "default-bold", "left", "top", false, false, false, false, false) CorTag = tocolor(255, 255, 255) if getElementData(player, "Cor", true) then CorTag = tocolor(0, 255, 0) end end end end else table.remove(g_StreamedInPlayers, k) end end end addEventHandler("onClientRender", root, onClientRender) function CorTagid () if getElementData(localPlayer, "Cor", true) then setElementData(localPlayer, "Cor", false) else setElementData(localPlayer, "Cor", true) end end bindKey ( "z", "both", CorTagid ) function onClientElementStreamIn() if getElementType(source) == "player" and source ~= getLocalPlayer() then setPlayerNametagShowing(source, false) table.insert(g_StreamedInPlayers, source) end end addEventHandler("onClientElementStreamIn", root, onClientElementStreamIn) function onClientResourceStart() local players = getElementsByType("player") for k, v in pairs(players) do if isElementStreamedIn(v) and v ~= getLocalPlayer() then setPlayerNametagShowing(v, false) table.insert(g_StreamedInPlayers, v) end end end addEventHandler("onClientResourceStart", resourceRoot, onClientResourceStart) O else estava no lugar errado. Corrigido, teste ai
  8. local drawDistance = 7 g_StreamedInPlayers = {} function onClientRender() local cx, cy, cz, lx, ly, lz = getCameraMatrix() for k, player in pairs(g_StreamedInPlayers) do if isElement(player) and isElementStreamedIn(player) then local vx, vy, vz = getPedBonePosition(player, 4) local dist = getDistanceBetweenPoints3D(cx, cy, cz, vx, vy, vz) if dist < drawDistance and isLineOfSightClear(cx, cy, cz, vx, vy, vz, true, false, false) then local x, y = getScreenFromWorldPosition(vx, vy, vz + 0.3) if x and y then if getElementAlpha(player) > 0 then -- se o alpha do player for maior que 0 mostra o ID local ID = getElementData(player, "ID") or "N/A" local w = dxGetTextWidth(ID, 0.1, "default-bold") local h = dxGetFontHeight(1, "default-bold") dxDrawText(""..ID.."", x - 1 - w / 1, y - 1 - h - 12, w, h, CorTag, 1.20, "default-bold", "left", "top", false, false, false, false, false) CorTag = tocolor(255, 255, 255) if getElementData(player, "Cor", true) then CorTag = tocolor(0, 255, 0) end end end end end else table.remove(g_StreamedInPlayers, k) end end addEventHandler("onClientRender", root, onClientRender) function CorTagid () if getElementData(localPlayer, "Cor", true) then setElementData(localPlayer, "Cor", false) else setElementData(localPlayer, "Cor", true) end end bindKey ( "z", "both", CorTagid ) function onClientElementStreamIn() if getElementType(source) == "player" and source ~= getLocalPlayer() then setPlayerNametagShowing(source, false) table.insert(g_StreamedInPlayers, source) end end addEventHandler("onClientElementStreamIn", root, onClientElementStreamIn) function onClientResourceStart() local players = getElementsByType("player") for k, v in pairs(players) do if isElementStreamedIn(v) and v ~= getLocalPlayer() then setPlayerNametagShowing(v, false) table.insert(g_StreamedInPlayers, v) end end end addEventHandler("onClientResourceStart", resourceRoot, onClientResourceStart) Tente isto
  9. Mostre o código do resource que aparece o ID em cima da cabeça do player
  10. Você quer que o ID desapareça da onde?
  11. Você deve configurar isso no seu resource "nametag", verificando se o alpha do player for > 0 usando getElementAlpha.
  12. Troque setPedSkin(Esta função está obsoleta. Isso significa que seu uso é desencorajado e que pode não existir em versões futuras.) por setElementModel
  13. local skin = createMarker(2248.8073730469, -1208.7320556641, 1049.0234375 -1, 'cylinder', 1.0, 255, 0,0, 150) setElementInterior(skin, 10) setElementDimension(skin, 32) function setSkinP(hitElement, matchingDimension) if getElementType(hitElement) == "player" and matchingDimension then -- verifica se o elemento é um player e se o elemento esta na mesma dimensão que o marcador setPedSkin(hitElement, 305) -- seta a skin end end addEventHandler("onMarkerHit", skin, setSkinP) E não necessita da verificação com IsElementWithinMarker.
  14. Só funciona com algumas animações. Como esta por exemplo: function setAnim(player) setPedAnimation(player, "CARRY", "crry_prtial", 0, false) end addCommandHandler("anim", setAnim)
  15. Na linha 5 não foi inserido o 3 argumento do setElementData.
  16. Entendi, vou ver o que eu consigo fazer, obrigado pela ajuda!
  17. Mas daí, seria de segunda a sexta como foi feita a verificação e horários definidos, eu teria que alterar o cálculo todo dia?
  18. Entendi, estava server-side mas mudei, obrigado. No client-side retornaria a hora do client né?
  19. Olá pessoal, então, fiz este código para verificar dia e hora real. Em questão de otimização e consumo de cpu, será que essa é a melhor forma de fazer isso? function checkTime() local theDay = getRealDay() if theDay == "Segunda-feira" or theDay == "Terca-feira" or theDay == "Quarta-feira" or theDay == "Quinta-feira" or theDay == "Sexta-feira" then local theTime = getTimeServer() if theTime == "17:08:00" then triggerClientEvent("onPlayerGetText", root, "BOT: Teste") end end end setTimer(checkTime, 1000, 0) local dias = {"Domingo","Segunda-feira","Terca-feira","Quarta-feira","Quinta-feira","Sexta-feira","Sabado"} function getRealDay() local time = getRealTime() return dias[tonumber(time.weekday)+1] end function getTimeServer() local time = getRealTime() local hours = time.hour local minutes = time.minute local seconds = time.second if hours < 10 then hours = "0"..hours end if minutes < 10 then minutes = "0"..minutes end if seconds < 10 then seconds = "0"..seconds end return hours..":"..minutes..":"..seconds end
  20. @Lord Henry desculpe, acabei me esquecendo disso, realmente você tem razão.
  21. Substitua isso: if (getElementData(source,"pecas.mecanico") == 7) then Por isso: local dataParts = getElementData(source, "pecas.mecanico") if (dataParts and dataParts == 7) then
  22. Tente isto: addEvent ( "onClientRequestRepair", true ); addEventHandler ( "onClientRequestRepair", root, function ( element ) local ePos = { getElementPosition ( element ) }; local pPos = { getElementPosition ( source ) }; local distance = getDistanceBetweenPoints3D ( ePos[1], ePos[2], ePos[3], pPos[1], pPos[2], pPos[3] ); if not isObjectInACLGroup ("user."..accName,aclGetGroup("Mecanico")) then return addNotification(source, "Não percebes nada disso, deixa com os especialistas!", "error") end if ( distance > 3 ) then if not (playerReparando[source]) then if (getElementData(source,"pecas.mecanico") == 7) then if (getElementModel(source, 50)) then setPedAnimation(source, "BOMBER", "bom_plant", -1, true, false); triggerClientEvent(source, "mecanico:reparando", source, config.timeToWait); playerReparando[source] = true; playerReparandoTimer[source] = setTimer( function(source) playerReparando[source] = nil; setPedAnimation(source, nil); fixVehicle ( element ); end, config.timeToWait * 60000, 1, source) else addNotification(source, "Não podes reparar um carro assim com essa roupinha nova, vais-te sujar todo!", "warning") end else addNotification(source, "Não tens peças suficientes para reparar o veículo!", "error") end else addNotification(source, "Já estás a reparar um veículo!", "warning") end else addNotification(source, "Não tem nenhum veículo nas proximidades!", "warning") end end )
  23. Você não definiu source no setTimer Tente: function ProcessarMaconha () if getElementData(source,"FolhaDaMaconha") >= 10 then local FolhaDaMaconha = getElementData(source,"FolhaDaMaconha") local TijoloDeMaconha = getElementData(source,"TijoloDeMaconha") setPedAnimation(source,"CARRY","putdwn05",-1,false,false,true,false) setElementData(source, "FolhaDaMaconha",getElementData(source,"FolhaDaMaconha") -10 ) setElementData(source, "TijoloDeMaconha",getElementData(source,"TijoloDeMaconha")+1 ) outputChatBox("#000000╔═════════════════════════════════════════════════╗", source, 255,255,255,true) outputChatBox("#000000[#cf2d2dFazenda Ilegal#000000] #afafafVocê Usou 10 Folha de Maconha! #ffffffTotal: #cf2d2d"..FolhaDaMaconha.."#afafaf Folhas de Maconha", source, 255,255,255,true) outputChatBox("#000000╚═════════════════════════════════════════════════╝", source, 255,255,255,true) setTimer(function(p) outputChatBox("#000000╔═════════════════════════════════════════════════╗", p, 255,255,255,true) outputChatBox("#000000[#cf2d2dFazenda Ilegal#000000] #afafafVocê Processou mais 1 Tijolo! #ffffffTotal: #cf2d2d"..TijoloDeMaconha.."#afafaf Tijolo de Maconha", p, 255,255,255,true) outputChatBox("#000000╚═════════════════════════════════════════════════╝", p, 255,255,255,true) end, 5000, 1, source) else outputChatBox("#000000[#cf2d2dFazenda Ilegal#000000] #afafafVocê Não tem Folha de Maconha Suficiente, Para Processar!", source, 255,255,255,true) end end addEvent ( "ProcessarMaconha", true ) addEventHandler ("ProcessarMaconha", getRootElement(), ProcessarMaconha)
×
×
  • Create New...