Search the Community

Showing results for tags 'Lua'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Multi Theft Auto: San Andreas 1.x
    • Support for MTA:SA 1.x
    • User Guides
    • Open Source Contributors
    • Suggestions
    • Ban appeals
  • General MTA
    • News
    • Media
    • Site/Forum/Discord/Mantis/Wiki related
    • MTA Chat
    • Other languages
  • MTA Community
    • Scripting
    • Maps
    • Resources
    • Other Creations & GTA modding
    • Competitive gameplay
    • Servers
  • Other
  • Archive
  • Private Bugtracker

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


About Me


Gang


Location


Occupation


Interests

Found 341 results

  1. function Tared (policePed,hitElement,dim) setPedAnalogControlState(policePed, "accelerate", 1) end addEvent( "Tared", true ) addEventHandler( "Tared", localPlayer, Tared ) ابي البوت يطارد الاعب الي لمس الماركر الي اسمة Marker1 هل ممكن مساعدة؟
  2. local Marker1 = createMarker(-82.43913, -907.21539, 17.27800 ,"cylinder", 2, 0, 0, 255, 255) addEventHandler("onMarkerHit",Marker1, function (hitElement,matchingDimension) local policePed = createPed (280, -148.21268, -959.39343, 28.35586) local PoliceCar = createVehicle(597, -148.21268, -959.39343, 28.35586, 359.447, 0.000, 90) warpPedIntoVehicle ( policePed, PoliceCar) end ) ابي اخلي البيد الي اسمة policePed يطارد الاعب ممكن مساعدة؟
  3. السلام عليكم ورحمة الله وبركاتة انا كنت ابي اسوي بوت اول ما المس ماركر معين يروح البوت يظهر بسيارت شرطة ويطاردني ممكن مساعدة؟
  4. السلام عليكم ورحمة الله وبركاتة كنت اتمني ان اقوم بعمل مود بسيط واود مساعدتكم في تصميمة انا اود ان افعل سكربت صغير عبارة عن عند كتابت امر up علي سبيل المثال يقوم بحمل الاعب الذي يقوم بكتابت اسمة والاعب المحمول يقوم بعمل انيماشن معين هل بامكانكم مساعدتي؟
  5. مساعدة بسيطة علي كود اريد ان تظهر العلامات في الخريطة تدريجيا وليس جميعها في وقت واحد وعندما المس اي ماركر يقوم بحذف الماركر والعلامة ونقلنلي لماركر والعلامة التي تليها حتي انتهي من جميع الماركرات التي بالجدول اتمني منكم مساعدتي رجائا انا في مرحة التعلم رجائا اي تعديل يرجا ان تعدلة علي الكود الاساسي GUIEditor = { button = {}, window = {}, memo = {} } local targetMar = { {1345.76172, 343.09811, 19}, {205.60931, -174.15186, 1}, {2264.45654, 63.23068, 25}, {696.72180, -442.32590, 15}, {-85.84571, -1189.86865, 0.5} } local mar = {} local bli = {} function newTar() --setElementModel(localPlayer,22) setElementData(localPlayer,"pizzaDone",0) for i,v in pairs ( targetMar ) do mar[i] = createMarker(v[1],v[2],v[3],"cylinder",2,255,255,0) bli[i] = createBlip(v[1],v[2],v[3],0) setElementData(mar[i],"pizzaMar",true) end addEventHandler("onClientMarkerHit",root,onTarHit) outputChatBox("Go to the signs on the map to deliver the smuggled goods when you finish 5 counting areas and get the required amount",255,0,0) end function finishJob() removeEventHandler("onClientMarkerHit",finMar,finishJob) destroyElement(finMar) destroyElement(blipfin) outputChatBox("Good Job ! Here's your money !",255,255,0) triggerServerEvent("onDone",resourceRoot) newTar() end function onTarHit() if getElementData(localPlayer,"pizzaOccupent") == true and getElementData(source,"pizzaMar") == true then local piz = getElementData(localPlayer,"pizzaDone") if not piz then piz = 0 end destroyElement(source) setElementData(localPlayer,"pizzaDone",piz+1) piz = piz+1 outputChatBox(piz.."/5 completed !",0,255,0) if piz == 5 then removeEventHandler("onClientMarkerHit",root,onTarHit) for _,v in pairs ( bli ) do destroyElement(v) end outputChatBox("Come back now to receive your money",255,255,0) finMar = createMarker(-52.76169, -225.02179, 5.42969, "cylinder", 2, 255, 255, 0) blipfin = createBlip(-52.76169, -225.02179, 5.42969, 0) addEventHandler("onClientMarkerHit",finMar,finishJob) end end end function onClick() if source == GUIEditor.button[1] then --setElementModel(localPlayer,22) for i,v in pairs ( targetMar ) do mar[i] = createMarker(v[1],v[2],v[3],"cylinder",2,255,255,0) bli[i] = createBlip(v[1],v[2],v[3],0) setElementData(mar[i],"pizzaMar",true) end addEventHandler("onClientMarkerHit",root,onTarHit) setElementData(localPlayer,"pizzaOccupent",true) outputChatBox("Go to the signs on the map to deliver the smuggled goods when you finish 5 counting areas and get the required amount",255,0,0) removeEventHandler("onClientGUIClick",root,onClick) destroyElement(GUIEditor.window[1]) showCursor(false) elseif source == GUIEditor.button[2] then for _,v in pairs ( mar ) do destroyElement(v) end for _,v in pairs ( bli ) do destroyElement(v) end setElementData(localPlayer,"pizzaDone",0) --setElementModel(localPlayer,0) setElementData(localPlayer,"pizzaOccupent",false) outputChatBox("Good Baay!",0,255,0) removeEventHandler("onClientGUIClick",root,onClick) destroyElement(GUIEditor.window[1]) showCursor(false) end end addEvent("onPizzaHit",true) addEventHandler("onPizzaHit",root, function () GUIEditor.window[1] = guiCreateWindow(0.28, 0.30, 0.42, 0.40, "- Pizza Man -", true) guiWindowSetMovable(GUIEditor.window[1], false) guiWindowSetSizable(GUIEditor.window[1], false) GUIEditor.memo[1] = guiCreateMemo(0.09, 0.17, 0.48, 0.69, "\nIn this job you must successfully deliver smuggled weapons. Connect all weapons and promise to get your money back.", true, GUIEditor.window[1]) GUIEditor.button[1] = guiCreateButton(0.63, 0.24, 0.32, 0.20, "Accept Job", true, GUIEditor.window[1]) GUIEditor.button[2] = guiCreateButton(0.63, 0.54, 0.32, 0.20, "Decline / Remove From Job", true, GUIEditor.window[1]) showCursor(true) addEventHandler("onClientGUIClick",root,onClick) end )
  6. --------------------------------- السلام عليكم ممكن تساعدوني انا ابي السيارة الي يصنعها الاعب عند لامس الماركر هو فقط الي يقدر ييركبها ولو نزل منها لمدة 30 ثانية السيارة تتمسح واذا كان معة السيارة ما يقدر يصنع سيارة غيرها بيلز سعدوني ارجوكم انا حموت واتعلم الحتي دي
  7. redditing

    Button

    -- Client Side 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") guiEditSetMaxLength(EditBox, 3) guiSetVisible(EditBox, false) addEventHandler("onClientGUIClick", Button function() local inputBox = tonumber(guiGetEdit(EditBox)) if inputBox==0 then outputChatBox("U set value input "..inputBox, 255, 255, 0) end end) -- Another Client Side addCommandHandler("TurnOnButton", function() guiSetVisible(Button, true) guiSetVisible(EditBox, true) end) I don't know what's wrong, but when I type the command 'TurnOnButton' I can't click the button and the editBox as if they didn't exist
  8. Olá Se você sabe programar em Lua e QUER TRABALHAR DE FATO, entre em contato comigo caso queira ganhar dinheiro. Quero: 1 gamemode de Hot Pursuit - perseguição de polícia contra ladrão 1 gamemode de training - basicamente é só um painel pra escolher um mapa e treinar - Algumas customizações simples pra veículos - Uns paineis simples Se for pra ficar de enrolação, demorar 2 dias pra responder uma coisa simples, não dar nem sinal de vida de como está indo o projeto, não entre em contato. Caso queira se comprometer ao trabalho, fale comigo, que serás muito bem pago. Abraços Jayb
  9. Olá, estou como ideia de converter um guiGrid em DxGrid usando o mode dxLib, mas eu não estou conseguindo criar as colunas, só queria um retângulo preto que é a lista sem colunas. Peguei essa função de um mod (vou chamar de mod A) que usa dxGrid e coloquei no meu mod (mod B) , n funciona(já botei o dxGrid.Lua no meta). Apaguei todas as funções que se comunica com o dxGrid.Lua do mod A e apaguei, deixe só a função abaixo e a Lista e as Colunas foram criadas normalmente. Coloquei a função no mod B e só criou a Lista sem coluna.(Tentei trocar o nome da Lista para ver se funcionava e não deu certo também) addEventHandler("onClientResourceStart", resourceRoot, function () Arm_Test = dxGridW:Create(470, 303, 427, 157) Arm_Test:AddColumn("Jogador", 207) Arm_Test:AddColumn("Arma", 210) Arm_Test:SetVisible(true) end)
  10. function premiumhud() local px,py,pz = getElementPosition(getLocalPlayer()) local x,y,z = getElementPosition(getLocalPlayer()) local distance = getDistanceBetweenPoints3D ( x,y,z,px,py,pz) if distance <= 10 then local sx,sy = getScreenFromWorldPosition ( x, y, z+1.12, 0.05 ) if not sx then return end local scale = 0.01/(0.01 * (distance / 1)) dxDrawText ( "Premium", sx, sy, sx, sy + 25, tocolor(255,230,100,255), math.min ( 0.07 *(180/distance),1.8), "clear-normal", "center", "bottom", false, false, false ) end end addCommandHandler("premium", premiumhud) Kiedy wpisuje komendę /premium na czacie, pojawia mi się na chwile napis po czym szybko znika. Chciałbym, aby to pokazywało się do czasu opuszczenia serwera. Oraz chciałbym zrobić to na uprawnienie, czyli osoba która ma wybraną range w pliku ACL może wpisać tą komende. Czekam na szybką pomoc!
  11. Gostaria de saber como faço para adicionar grupos ACL nestes chat Help-me function MensagemTwitter(source, cmd, ...) local MessagemT = table.concat ( { ... }, " " ) local name = getPlayerName(source); for _,v in ipairs(getElementsByType("player")) do outputChatBox("#00BFFF[ Twitter ] #FFFFFF "..name.." #FFFFFF: #00BFFF"..MessagemT,v, 255, 255, 255, true) --efeito no chat end end addCommandHandler("Twitter", MensagemTwitter) function MensagemAnon(source, cmd, ...) local MessagemANS = table.concat ( { ... }, " " ); for _,v in ipairs(getElementsByType("player")) do outputChatBox("#ffffff[ #696969 Anônimo #ffffff] #696969"..MessagemANS,v, 255, 255, 255, true) --efeito no chat end end addCommandHandler("Ans", MensagemAnon) function MensagemRP(source, cmd, ...) local MessagemFRP = table.concat ( { ... }, " " ); local name = getPlayerName(source); local getID = getElementData(source, "ID") or "n.a" for _,v in ipairs(getElementsByType("player")) do outputChatBox("#A9A9A9[ @Global ]#ffffff "..name.." #A9A9A9(ID:"..getID..") #A9A9A9 ❱ #ffffff"..MessagemFRP,v, 255, 255, 255, true) --efeito no chat end end addCommandHandler("forarp", MensagemRP) addEventHandler("onPlayerJoin", getRootElement(), function() bindKey(source, "k", "down", "chatbox", "Ans")--bind end ) addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), function() for index,player in pairs(getElementsByType("player")) do bindKey(player,"k", "down", "chatbox", "Ans") --bind end end ) addEventHandler("onPlayerJoin", getRootElement(), function() bindKey(source, "u", "down", "chatbox", "Twitter") --bind end ) addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), function() for index,player in pairs(getElementsByType("player")) do bindKey(player,"u", "down", "chatbox", "Twitter") --bind end end ) addEventHandler("onPlayerJoin", getRootElement(), function() bindKey(source, "i", "down", "chatbox", "forarp") --bind end ) addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), function() for index,player in pairs(getElementsByType("player")) do bindKey(player,"i", "down", "chatbox", "forarp") --bind end end )
  12. Olá, estou a efetuar uma criação de servidor no estilo dayz, porém diferente dos demais presentes, preciso urgentemente de ajuda na parte de scripts, preciso de um scripter profissional em Lua urgente, pois temos muitos projetos para avançar e não consigo pelo o facto de ser preciso scripts. Caso alguém esteja interessado em nos ajudar, agradeço imenso. Obs: Todo o trabalho será pago. Deixarei disponível os contactos para quem estiver interessado a participar do nosso projeto. Obrigado. Discord: Mustang#1636 Gribix#3409 Discord
  13. Queria ajuda para quando eu digitar certo comando no chat, ativar o efeito "gunflash" nos determinados locais que está no script, ex: /backfire Mas sinto que está faltando algo nesse código, obs: não é meu, está disponível na web, só preciso de ajuda mesmo. Desde já agradeço a qualquer tipo de ajuda. ENGINE_ENABLED = true ENGINE_VOLUME_MASTER = 0.15 -- volume multiplier ENGINE_VOLUME_THROTTLE_BOOST = 2.5 -- boosting engine volume if we use throttle ENGINE_SOUND_FADE_DIMENSION = 6969 -- dimension for unloading sounds ENGINE_SOUND_DISTANCE = 80 -- max distance DEBUG = false -- offsets of exhaust flames local als = { [411] = { {-0.60, -2.4, -0.3}, }, [451] = { {0, -2.5, -0.35}, }, [506] = { {-0.44, -2.4, -0.20}, {-0.38, -2.4, -0.20}, }, [401] = { {-0.70, -2.2, -0.4}, {0.70, -2.2, -0.4}, }, [503] = { {-0.50, -2.4, -0.3}, {0.50, -2.4, -0.3}, }, [419] = { {-0.50, -2.5, -0.3}, {0.50, -2.5, -0.3}, }, [562] = { {-0.70, -2.4, -0.3}, {0.70, -2.4, -0.3}, }, [534] = { {-0.70, -2.2, -0.3}, {0.70, -2.2, -0.3}, }, [496] = { {-0.65, -2.4, -0.4}, }, [494] = { {-0.50, -2.3, -0.2}, {0.50, -2.3, -0.2}, }, [517] = { {-0.60, -2.3, -0.5}, {0.60, -2.4, -0.5}, }, [541] = { {-0.62, -2.3, -0.4}, {0.62, -2.4, -0.4}, }, [458] = { {-0.70, -2.7, -0.5}, {0.70, -2.7, -0.5}, }, [529] = { {-0.68, -2.4, -0.3}, {0.68, -2.4, -0.3}, }, [429] = { {-0.40, -2.5, -0.3}, {0.40, -2.5, -0.3}, }, [405] = { {-0.60, -2.8, -0.3}, {0.60, -2.8, -0.3}, }, [602] = { {-0.55, -2.4, -0.2}, }, [555] = { {-0.50, -2.4, -0.6}, {0.50, -2.4, -0.6}, }, [507] = { {-0.65, -2.9, -0.4}, {0.65, -2.9, -0.4}, }, [420] = { {-0.10, -2.4, -0.3}, {0.10, -2.4, -0.3}, }, [546] = { {0.50, -2.4, -0.3}, }, [565] = { {-0.50, -2.3, -0.5}, {0.50, -2.3, -0.5}, }, [410] = { {-0.55, -2.1, -0.4}, {0.55, -2.1, -0.4}, }, [421] = { {0.60, -2.7, 0.09}, {0.70, -2.7, 0.09}, }, [492] = { {-0.160, -2.3, -0.4}, {0.190, -2.3, -0.4}, }, [561] = { {0.70, -2.7, -0.3}, }, [426] = { {0.65, -2.5, -0.5}, }, [585] = { {0.70, -2.3, -0.3}, }, [547] = { {-0.60, -2.7, -0.3}, {0.60, -2.7, -0.3}, }, [451] = { {-0.45, -2.1, -0.4}, {0.45, -2.1, -0.4}, }, [527] = { {-0.65, -2.2, -0.4}, {0.65, -2.2, -0.4}, }, [491] = { {-0.59, -2.5, -0.4}, {0.59, -2.5, -0.4}, }, [558] = { {0.50, -2.9, -0.3}, }, [558] = { {0.50, -2.9, -0.3}, }, [466] = { {-0.65, -2.7, -0.2}, {0.65, -2.7, -0.2}, }, [560] = { {-0.70, -2.7, -0.5}, }, [526] = { {-0.65, -2.7, -0.3}, {0.65, -2.7, -0.3}, }, [404] = { {-0.50, -2.6, -0.5}, {0.50, -2.6, -0.5}, }, [589] = { {-0.50, -2.5, -0.5}, {0.50, -2.5, -0.5}, }, [438] = { {-0.60, -2.1, -0.1}, {0.60, -2.1, -0.1}, }, [409] = { {-0.55, -2.8, -0.3}, }, [479] = { {-0.55, -2.6, -0.3}, {0.55, -2.6, -0.3}, }, } local streamedVehicles = {} local pi = math.pi function calculateGearRatios(vehicle, maxRPM, startRatio) local ratios = {} local handling = getVehicleHandling(vehicle) local gears = math.max(4, handling.numberOfGears) local maxVelocity = handling.maxVelocity local acc = handling.engineAcceleration local drag = handling.dragCoeff --local c = ((acc*maxVelocity) / maxRPM)*(maxRPM*0.00175) --local c = startRatio or ((acc / drag / maxVelocity) * pi) * 20 local curGear, curRatio = 1, 0 local mRPM = maxVelocity * 100 mRPM = ((maxRPM*gears)/mRPM)*maxRPM repeat if mRPM/curGear > maxRPM*curRatio then curRatio = curRatio+0.1/curGear else ratios[curGear] = curRatio*0.95 curGear = curGear+1 curRatio = 0 end until #ratios == gears ratios[0] = 0 ratios[-1] = ratios[1] --[[ ratios[0] = 0 for gear=1, gears do if gear > 1 then c = c - c*(gear*0.02) end ratios[gear] = (c / gear) end ratios[-1] = ratios[1] --]] return ratios end function updateEngines(dt) if not ENGINE_ENABLED then return end local myVehicle = getPedOccupiedVehicle(localPlayer) if myVehicle and getVehicleController(myVehicle) ~= localPlayer then myVehicle = false end local cx, cy, cz = getCameraMatrix() local now = getTickCount() for vehicle, data in pairs(streamedVehicles) do if isElement(vehicle) then local engine = getElementData(vehicle, "vehicle:engine") if engine then local x, y, z = getElementPosition(vehicle) local rx, ry, rz = getElementRotation (vehicle) local distance = getDistanceBetweenPoints3D(x, y, z, cx, cy, cz) if getVehicleEngineState(vehicle) == true and distance < ENGINE_SOUND_DISTANCE*2 then local model = getElementModel(vehicle) local handling = getVehicleHandling(vehicle) local velocityVec = Vector3(getElementVelocity(vehicle)) local velocity = velocityVec.length * 180 local controller = getVehicleController(vehicle) local upgrades = getElementData(vehicle, "vehicle:upgrades") or {} engine.gear = engine.gear or 1 engine.turbo = upgrades.turbo engine.turbo_shifts = upgrades.turbo engine.volMult = engine.volMult or 1 engine.shiftUpRPM = engine.shiftUpRPM or engine.maxRPM*0.91 engine.shiftDownRPM = engine.shiftDownRPM or (engine.idleRPM+engine.maxRPM)/2.5 data.prevThrottle = data.throttle data.throttle = controller and (getPedControlState(controller, "accelerate")) if not data.reverse and velocity < 10 then data.reverse = controller and (getPedAnalogControlState(controller, "brake_reverse") > 0.5)or false elseif data.throttle and velocity < 50 then data.reverse = false end local isSkidding = controller and ( ( getPedControlState(controller, "accelerate") and getPedControlState(controller, "brake_reverse") or getPedControlState(controller, "handbrake") ) and velocity < 40 ) or false data.forceNeutral = isSkidding -- w / s or handbrake without moving: neutral gear or (isLineOfSightClear(x, y, z, x, y, z-(getElementDistanceFromCentreOfMassToBaseOfModel(vehicle)*1.25), true, false, false, true, true, false, false, vehicle) and data.throttle) -- vehicle in air: neutral gear or isElementFrozen(vehicle) or isElementInWater(vehicle) -- frozen / in water: neutral gear or (( rx > 110 ) and ( rx < 250 )) -- on roof: neutral gear data.groundRPM = data.groundRPM or 0 data.throttlingRPM = data.throttlingRPM or 0 data.previousGear = data.previousGear or engine.gear data.gear = data.gear or 1 data.currentGear = data.currentGear or 1 data.changingGear = type(data.changingGear) == "number" and data.changingGear or false data.changingRPM = data.changingRPM or 0 data.changingTargetRPM = data.changingTargetRPM or 0 data.turboValue = data.turboValue or 0 data.prevTurboValue = data.turboValue data.als = upgrades.als or false data.effects = data.effects or {} local changedGear = false local gearRatios = calculateGearRatios(vehicle, engine.maxRPM, engine.startRatio or 1) local soundPack = engine.soundPack local wheel_rpm = velocity*100 local rpm = wheel_rpm -- engine rpm --if data.reverse then --data.currentGear = -1 --end -- calculating rpm + neutral gear if getVehicleController(vehicle) then rpm = rpm*gearRatios[data.gear] else rpm = engine.idleRPM end if not data.forceNeutral then data.throttlingRPM = math.max(0, data.throttlingRPM - (engine.maxRPM*0.0012)*dt) else if data.throttle then data.throttlingRPM = data.throttlingRPM + (engine.maxRPM*0.0012)*dt else data.throttlingRPM = math.max(0, data.throttlingRPM - (engine.maxRPM*0.0012)*dt) end data.throttlingRPM = math.min(data.throttlingRPM, engine.maxRPM) end rpm = rpm+data.throttlingRPM -- smooth rpm change rpm = rpm+data.changingRPM if data.changingGear then local progress = (now-data.changingTargetRPM.time) / 300 -- how long data.changingRPM = interpolateBetween(data.changingTargetRPM.target, 0, 0, 0, 0, 0, progress, "InQuad") if progress >= 1 then data.changingGear = false data.changingGearDirection = false data.changingRPM = 0 data.changingTargetRPM = false end end if data.previousGear ~= data.currentGear then changedGear = (data.currentGear < data.previousGear) and "down" or "up" data.changingGear = data.currentGear data.changingGearDirection = changedGear local nextrpm = engine.maxRPM if gearRatios[data.changingGear] then nextrpm = wheel_rpm*gearRatios[data.changingGear] end data.changingRPM = rpm-nextrpm data.changingTargetRPM = {target=data.changingRPM, time=now} data.gear = data.currentGear data.turboValue = 0 end -- prev gear update data.previousGear = data.currentGear -- change gears if not data.changingGear and data.throttlingRPM == 0 and wheel_rpm > 200 then if rpm > engine.shiftUpRPM and data.throttle then data.currentGear = math.min(data.currentGear+1, math.max(4, getVehicleHandling(vehicle).numberOfGears)) elseif rpm < engine.shiftDownRPM then data.currentGear = math.max(1, data.currentGear-1) end end -- rev limiter if rpm < engine.idleRPM then rpm = engine.idleRPM+math.random(0,100) elseif rpm > engine.maxRPM then rpm = engine.maxRPM-math.random(0,100) data.wasRevLimited = true end -- ALS if data.wasRevLimited then -- when using throttle if (data.rpm or 0) < engine.maxRPM*0.98 then data.wasRevLimited = false if data.als then data.activeALS = true end end else if changedGear == "up" and math.random(1, 4) == 1 then -- randomly with gear change if data.als then data.activeALS = true end elseif data.prevThrottle and not data.throttle and data.rpm > engine.maxRPM*0.5 and math.random(1, 2) == 1 then if data.als then data.activeALS = true end end end -- save rpm data.rpm = rpm -- turbo if engine.turbo then if data.throttle and rpm > engine.maxRPM/2 then data.turboValue = math.min(0.5, data.turboValue+ 0.0008*dt) else data.turboValue = math.max(0, data.turboValue - 0.0005*dt) end end -- sounds local svol = {} if not data.sounds then data.sounds = {} data.sounds[1] = playSound3D("sounds/"..soundPack.."/1.wav", x, y, z, true) data.sounds[2] = playSound3D("sounds/"..soundPack.."/2.wav", x, y, z, true) data.sounds[3] = playSound3D("sounds/"..soundPack.."/3.wav", x, y, z, true) data.sounds[4] = playSound3D("sounds/turbo.wav", x, y, z, true) for i=1, 3 do setSoundEffectEnabled(data.sounds[i], "compressor", true) end else -- engine local minMidProgress = math.min(1, (rpm+500)/(engine.maxRPM/2)) local maxMidProgress = minMidProgress - ((engine.maxRPM/2)/rpm) local highProgress = (rpm-(engine.maxRPM/2.2))/(engine.maxRPM/2.2) svol[1] = 1 - 2^(rpm/(engine.idleRPM*1.5) - 2) svol[2] = minMidProgress < 1 and interpolateBetween(0, 0, 0, 0.8, 0, 0, minMidProgress, "InQuad") or interpolateBetween(0.8, 0, 0, 0, 0, 0, maxMidProgress, "OutQuad") svol[3] = interpolateBetween(0, 0, 0, 1, 0, 0, highProgress, "OutQuad") local vol = svol[1] vol = vol*ENGINE_VOLUME_MASTER*engine.volMult if data.throttle then vol = vol*ENGINE_VOLUME_THROTTLE_BOOST end setSoundVolume(data.sounds[1], math.max(0, vol)) setSoundSpeed(data.sounds[2], rpm/(engine.idleRPM*2)) local vol = svol[2] vol = vol*ENGINE_VOLUME_MASTER*engine.volMult if data.throttle then vol = vol*ENGINE_VOLUME_THROTTLE_BOOST end if data.changingGearDirection == "up" and vol > 0.1 then vol = vol/2 end setSoundVolume(data.sounds[2], math.max(0, vol)) setSoundSpeed(data.sounds[2], rpm/(engine.maxRPM*0.6)) local vol = svol[3] vol = vol*ENGINE_VOLUME_MASTER*engine.volMult if data.throttle then vol = vol*ENGINE_VOLUME_THROTTLE_BOOST end if data.changingGearDirection == "up" and vol > 0.1 then vol = vol/2 end setSoundVolume(data.sounds[3], math.max(0, vol)) setSoundSpeed(data.sounds[3], rpm/(engine.maxRPM*0.925)) svol[4] = data.turboValue local vol = svol[4]*ENGINE_VOLUME_MASTER if data.throttle then vol = vol*ENGINE_VOLUME_THROTTLE_BOOST end setSoundVolume(data.sounds[4], math.max(0, vol*0.9)) setSoundSpeed(data.sounds[4], svol[4]+0.8) if ((changedGear == "up" and data.prevTurboValue > 0.2) or (not data.throttle and data.prevTurboValue > 0.2)) and engine.turbo_shifts then local sound = 1 if changedGear then sound = changedGear and changedGear == "up" and tostring(2) or tostring(1) end data.sounds[5] = playSound3D("sounds/turbo_shift"..sound..".wav", x, y, z, false) setSoundVolume(data.sounds[5], 0.6*ENGINE_VOLUME_MASTER) if not data.throttle then data.turboValue = 0 end end if data.activeALS and not isElement(data.sounds[6]) then data.sounds[6] = playSound3D("sounds/als"..math.random(1, 13)..".wav", x, y, z, false) setSoundVolume(data.sounds[6], 0.8) setSoundSpeed(data.sounds[6], 1.1) --setSoundEffectEnabled(data.sounds[6], "reverb", true) setSoundEffectEnabled(data.sounds[6], "echo", true) setSoundEffectEnabled(data.sounds[6], "compressor", true) for _, offset in ipairs((als[model] or {})) do local ef = createEffect("gunflash", x, y, z, 0, 0, 0) setEffectSpeed(ef, 0.25) setEffectDensity(ef, 2) data.effects[ef] = {offset[1], offset[2], offset[3], 90, 0, 180} setTimer(function() data.effects[ef] = nil destroyElement(ef) end, 1000, 1) end data.activeALS = false end for i=1, #data.sounds do local v = data.sounds[i] if isElement(v) then setElementPosition(v, x, y, z) setElementDimension(v, (svol[i] or 1) > 0 and getElementDimension(vehicle) or ENGINE_SOUND_FADE_DIMENSION) if vehicle == getPedOccupiedVehicle(localPlayer) then setSoundMaxDistance(v, ENGINE_SOUND_DISTANCE*2) else setSoundMaxDistance(v, ENGINE_SOUND_DISTANCE) end end end local rx, ry, rz = getElementRotation(vehicle) for ef, offset in pairs(data.effects) do if isElement(ef) then local ox, oy, oz = getPositionFromElementOffset(vehicle, offset[1], offset[2], offset[3]) setElementPosition(ef, ox, oy, oz) setElementRotation(ef, offset[4]-rx, offset[5]-ry, offset[6]-rz) end end end if DEBUG and vehicle == myVehicle then dxDrawText("Silnik\nTyp: "..tostring(engine.name).."\nRPM: "..tostring(rpm).."\nVol1: "..tostring(svol[1]).."\nVol2: "..tostring(svol[2]).."\nVol3: "..tostring(svol[3]).."\nTurboVol: "..tostring(svol[4]), 300, 300) local t = "Biegi\nBieg: "..tostring(data.gear).."/"..tostring(#gearRatios).."\n" for k, v in ipairs(gearRatios) do t = t.."Ratio "..tostring(k)..": "..v.."\n" end dxDrawText(t, 300, 440) end else if data.sounds then for k, v in ipairs(data.sounds) do if isElement(v) then destroyElement(v) end end data.sounds = false end data.rpm = 0 data.gear = 1 data.previousGear = 0 end end end end end addEventHandler("onClientPreRender", root, updateEngines) blowdurum = false function blowac() if blowdurum == false then addEventHandler( "onClientHUDRender", root,updateEngines) blowdurum = true end end function blowkapa() if blowdurum == true then removeEventHandler( "onClientHUDRender", root,updateEngines) blowdurum = false end end function streamInVehicle(vehicle) if not streamedVehicles[vehicle] then if isElement(vehicle) and getElementData(vehicle, "vehicle:engine") then streamedVehicles[vehicle] = {} addEventHandler("onClientElementDestroy", vehicle, function() streamOutVehicle(source) end) end end end function streamOutVehicle(vehicle) if streamedVehicles[vehicle] then if streamedVehicles[vehicle].sounds then for k, v in ipairs(streamedVehicles[vehicle].sounds) do if isElement(v) then destroyElement(v) end end end streamedVehicles[vehicle] = nil end end function toggleGTAEngineSounds(bool) setWorldSoundEnabled(7, bool) setWorldSoundEnabled(8, bool) setWorldSoundEnabled(9, bool) setWorldSoundEnabled(10, bool) setWorldSoundEnabled(11, bool) setWorldSoundEnabled(12, bool) setWorldSoundEnabled(13, bool) setWorldSoundEnabled(14, bool) setWorldSoundEnabled(15, bool) setWorldSoundEnabled(16, bool) setWorldSoundEnabled(40, bool) end function getGTARPM(vehicle) if (vehicle) then local velocityVec = Vector3(getElementVelocity(vehicle)) local velocity = velocityVec.length * 180 if (isVehicleOnGround(vehicle)) then if (getVehicleEngineState(vehicle) == true) then if(getVehicleCurrentGear(vehicle) > 0) then vehicleRPM = math.floor(((velocity/getVehicleCurrentGear(vehicle))*150) + 0.5) if (vehicleRPM < 650) then vehicleRPM = math.random(650, 750) elseif (vehicleRPM >= 8000) then vehicleRPM = 8000 end else vehicleRPM = math.floor(((velocity/1)*220) + 0.5) if (vehicleRPM < 650) then vehicleRPM = math.random(650, 750) elseif (vehicleRPM >= 8000) then vehicleRPM = 8000 end end else vehicleRPM = 0 end else if (getVehicleEngineState(vehicle) == true) then vehicleRPM = vehicleRPM - 150 if (vehicleRPM < 650) then vehicleRPM = math.random(650, 750) elseif (vehicleRPM >= 8000) then vehicleRPM = 8000 end else vehicleRPM = 0 end end return tonumber(vehicleRPM) else return 0 end end -- EKSPORT function getVehicleRPM(vehicle) if streamedVehicles[vehicle] then return streamedVehicles[vehicle].rpm or getGTARPM(vehicle) else return getGTARPM(vehicle) end end function getVehicleGear(vehicle) if streamedVehicles[vehicle] then return streamedVehicles[vehicle].gear or getVehicleCurrentGear(vehicle) else return getVehicleCurrentGear(vehicle) end end function toggleEngines(bool) ENGINE_ENABLED = bool toggleGTAEngineSounds(not ENGINE_ENABLED) if bool == true then for k, v in ipairs(getElementsByType("vehicle", root, true)) do streamInVehicle(v) end else for vehicle, data in pairs(streamedVehicles) do streamOutVehicle(vehicle) end streamedVehicles = {} end end addEvent("onClientRefreshEngineSounds", true) addEventHandler("onClientRefreshEngineSounds", root, function() for _, v in pairs(streamedVehicles) do for _, sound in pairs(v.sounds or {}) do if isElement(sound) then stopSound(sound) end end v.sounds = nil end end) addEventHandler("onClientElementStreamIn", root, function() if getElementType(source) == "vehicle" then streamInVehicle(source) end end ) addEventHandler("onClientElementStreamOut", root, function() streamOutVehicle(source) end ) addEventHandler("onClientVehicleEnter", root, function(player, seat) if seat == 0 then setTimer(streamInVehicle, 200, 1, source) end end) addEventHandler("onClientResourceStart", resourceRoot, function() toggleEngines(true) end) addEventHandler("onClientResourceStop", resourceRoot, function() for k, v in pairs(streamedVehicles) do if v.sounds and #v.sounds > 0 then for _, sound in pairs(v.sounds) do if isElement(sound) then destroyElement(sound) end end end end toggleGTAEngineSounds(true) end) function getPositionFromElementOffset(element,offX,offY,offZ) local m = getElementMatrix ( element ) -- Get the matrix local x = offX * m[1][1] + offY * m[2][1] + offZ * m[3][1] + m[4][1] -- Apply transform local y = offX * m[1][2] + offY * m[2][2] + offZ * m[3][2] + m[4][2] local z = offX * m[1][3] + offY * m[2][3] + offZ * m[3][3] + m[4][3] return x, y, z -- Return the transformed point end
  14. After I finished the first version of my character customization system i just realized its such a piece of crap, so i started writing a new version with a whole new concept. The first version worked with CJ skin and i just attached some custom head models to it. Conversely the new version is running with shaders and the skin is a custom dff. Here is a video of the head customization. The clothing is in progress yet, it takes a lot of time because i have to make custom cloth models. Hope you like it. Please don't ask for the source code, this script will never be released. Sorry.
  15. estou tentando por um vídeo em vez de uma imagem (Exemplo o "Se Fodeu") quando o player morre, mas não esta indo, alguém ajuda ae?
  16. Boa tarde, caros usuários da F.MTA! Então pessoal, estou com um problema pra adicionar a função de comandos ao usar o chat local, eu gostaria de saber se algum programador poderia me explicar o que adicionar ou modificar? esse é o código / script: chat_range=100 addEventHandler("onPlayerJoin",getRootElement(), function () bindKey(source,"t","down","chatbox","LocalChat") end) addEventHandler("onResourceStart",getResourceRootElement(getThisResource()), function () for index, player in pairs(getElementsByType("player")) do bindKey(player,"t","down","chatbox","LocalChat") end end) function isPlayerInRangeOfPoint(player,x,y,z,range) local px,py,pz=getElementPosition(player) return ((x-px)^2+(y-py)^2+(z-pz)^2)^0.5<=range end function onChat(player,_,...) local px,py,pz=getElementPosition(player) local msg = table.concat({...}, " ") local nick=getPlayerName(player) local r,g,b = getTeamColor(getPlayerTeam(player)) for _,v in ipairs(getElementsByType("player")) do if isPlayerInRangeOfPoint(v,px,py,pz,chat_range) then outputChatBox("#00ff00[ Local ] #ffffff"..nick..": #FFFFFF"..msg,v,r,g,b,true) end end end addCommandHandler("LocalChat",onChat) Quem puder me ajudar agradeço dês de já. Att: ~ Zeus.
  17. Wraz ze znajomymi planujemy stworzyć sobie serwer typu Truck - taki ETS tylko w MTA. Poszukujemy wiec skryptera który napisałby nam skrypt na towary. Za skrypt jesteśmy w stanie zapłacić jeżeli spełni nasze oczekiwania. Jezeli jesteś zainteresowany wbij na tego dc - https://discord.gg/2EwRhve Tam dogadamy się co i jak Ew. podamy dodatkowy kontakt.
  18. Hello, sorry for bothering you again. I want to change this code so that I call the ID instead of its name, note that in line 1 another code is called "game_id2" in which he define the ID, I want to replace the / checkbinds playername with / checkbinds playerID example: /checkbinds 2 Code: I know it's not allowed to ask to edit scripts, if you can't, guide me on how to do this. Thanks.
  19. Alguem pode me ajudar com esse script de painel policial? ele esta funcionando quase tudo, mas não acha as armas do player function Revistar (source) local Jogador = getElementData(source, "TS:Abordando") if Jogador then setPedAnimation( source, "POLICE", "plc_drgbst_01", 3100, true, false, false, false) triggerClientEvent(Jogador, "addNotification", root, "#0037FF✘#ffffffINFO#0037FF✘➺ #ffffffO Policial está te revistando!", "info") if getPlayerWantedLevel(Jogador) >= 1 then outputChatBox("#0037FF✘#ffffffINFO#0037FF✘➺ #ffffff O jogador está pedido!",source,255,0,0,true) else outputChatBox("#0037FF✘#ffffffINFO#0037FF✘➺ #ffffff O jogador não está pedido!",source,255,0,0,true) end if getElementData(Jogador,"DNL:Categoria(A)") == true then outputChatBox("#0037FF✘#ffffffINFO#0037FF✘➺ #ffffff O jogador tem Habilitação A!",source,255,0,0,true) else outputChatBox("#0037FF✘#ffffffINFO#0037FF✘➺ #ffffff O jogador não tem Habilitação A!",source,255,0,0,true) end if getElementData(Jogador,"DNL:Categoria(B)") == true then outputChatBox("#0037FF✘#ffffffINFO#0037FF✘➺ #ffffff O jogador tem Habilitação B!",source,255,0,0,true) else outputChatBox("#0037FF✘#ffffffINFO#0037FF✘➺ #ffffff O jogador não tem Habilitação B!",source,255,0,0,true) end if getElementData(Jogador,"DNL:Categoria(C)") == true then outputChatBox("#0037FF✘#ffffffINFO#0037FF✘➺ #ffffff O jogador tem Habilitação C!",source,255,0,0,true) else outputChatBox("#0037FF✘#ffffffINFO#0037FF✘➺ #ffffff O jogador não tem Habilitação C!",source,255,0,0,true) end if getElementData(Jogador,"DNL:Categoria(D)") == true then outputChatBox("#0037FF✘#ffffffINFO#0037FF✘➺ #ffffff O jogador tem Habilitação D!",source,255,0,0,true) else outputChatBox("#0037FF✘#ffffffINFO#0037FF✘➺ #ffffff O jogador não tem Habilitação D!",source,255,0,0,true) end if getElementData(Jogador,"DNL:Categoria(E)") == true then outputChatBox("#0037FF✘#ffffffINFO#0037FF✘➺ #ffffff O jogador tem Habilitação E!",source,255,0,0,true) else outputChatBox("#0037FF✘#ffffffINFO#0037FF✘➺ #ffffff O jogador não tem Habilitação E!",source,255,0,0,true) end local Quantidade = getElementData(source, "TS:"..Droga_Selecionada.."") or 0 for slot = 0, 12 do local Armamento = getPedWeapon ( Jogador, slot ) if Armamento > 0 then local NomeDaArma = getWeaponNameFromID ( Armamento ) outputChatBox("#0037FF✘#ffffffINFO#0037FF✘➺ #ffffff O jogador tem "..NomeDaArma.."!",source,255,0,0,true) end end end end addEvent("TS:Revistar", true) addEventHandler("TS:Revistar", root, Revistar)
  20. Bom, eu queria colocar Tag num chat, porém, modifiquei o outputChatBox e não consegui. alguém pode me ajudar? Código: chat_range=100 function MensagemTwitter(source, cmd, ...) local MessagemT = table.concat ( { ... }, " " ) local name = getPlayerName(source); local getID = getElementData(source, "ID") or "N/A" for _,v in ipairs(getElementsByType("player")) do outputChatBox("*#00BFFF ᴍᴇssᴇɴɢᴇʀ - #ffffff["..getID.."] #ffffff"..name.."#FFFFFF - #FFFFFF"..MessagemT,v, 255, 255, 255, true) end end addCommandHandler("Twitter", MensagemTwitter) addCommandHandler("DeepWeb", function ( source, cmd, ... ) local message2 = #{...} > 0 and table.concat({...}," ") or nil if message2 then for _, p in ipairs (getElementsByType("player")) do if hasObjectPermissionTo(p, "command.mute", true) then outputChatBox("*#696969 ᴅᴇᴇᴘ ᴡᴇʙ - #ffffff"..getPlayerName(source).."#696969 - #696969"..message2, p, 255, 255, 255, true) else outputChatBox("*#696969 ᴅᴇᴇᴘ ᴡᴇʙ - #696969"..message2, p, 255, 255, 255, true) end end else end end ) addEventHandler("onPlayerJoin", getRootElement(), function() bindKey(source, "y", "down", "chatbox", "Twitter") end ) addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), function() for index,player in pairs(getElementsByType("player")) do bindKey(player,"y", "down", "chatbox", "Twitter") end end ) addEventHandler("onPlayerJoin", getRootElement(), function() bindKey(source, "u", "down", "chatbox", "DeepWeb") end ) addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), function() for index,player in pairs(getElementsByType("player")) do bindKey(player,"u", "down", "chatbox", "DeepWeb") end end )
  21. Queria saber se tem alguma function que posso usar para alterar a distância que a bala atinge, que alcance um alvo mais longe do que o padrão do mta!
  22. Anyone can send me a working yt mp3 converter API? Or how to create one, to play music from youtube on my server?
  23. How i can make a inventory system !:)
  24. I created a youtube player, and i want to remove the event handler, when the music ends, but i dont know how to get the song length from web browser... anyone can help?
  25. Não consigo colocar um painel de dj q eu uso pra funcionar no interior 3 dimensão 0 Audio = {} local abrirpainel = createMarker(-2660.5710449219, 1408.1665039063, 4.3,"cylinder", 2, 0, 255, 0, 100) -- Local do marker function mostrarpainel(thePlayer) triggerClientEvent(thePlayer, "Dj", getRootElement() ) end addEventHandler("onMarkerHit", abrirpainel, mostrarpainel) addEvent ( "CrioDJ", true ) addEventHandler ( "CrioDJ", root, function ( Link ) if ( Link ) then if ( isElement ( Audio [ source ] ) ) then local x, y, z = getElementPosition ( Audio [ source ] ) destroyElement ( Audio [ source ] ) end local x, y, z = getElementPosition ( source ) Audio [ source ] = createMarker(x-0.5, y+0.5, z - 1,"cylinder", 1, 0, 255, 255, 0) triggerClientEvent ( root, "CrioDJ", source, source, Link ) triggerClientEvent(root, "Djay", root, getPlayerName( source ) ) end end) addEvent ( "VolumealteradoDJ", true ) addEventHandler ( "VolumealteradoDJ", root, function ( to ) triggerClientEvent ( root, "VolumeDJ", source, source, to ) end ) addEvent ( "DestruiDJ", true ) addEventHandler ( "DestruiDJ", root, function ( ) if ( isElement ( Audio [ source ] ) ) then destroyElement ( Audio [ source ] ) triggerClientEvent ( root, "DestruiDJ", source, source ) end end ) client.Lua local screenW,screenH = guiGetScreenSize() local resW, resH = 1280, 1024 local x, y = (screenW/resW), (screenH/resH) local root = getRootElement() local volume_menos = 0.1 local volume_mais = 0.1 stream = {} dj = false animON = false info = false addEventHandler("onClientResourceStart", resourceRoot, function() Link = guiCreateEdit(x*411, y*374, x*408, y*46, "Cole o link aqui...", false) guiSetVisible ( Link, false ) end ) function dx () local alpha,alpha2,alpha3= interpolateBetween(0, 0, 0, 255, 136, 200, ((getTickCount() - djt) / 2000), "Linear") local meta = getSoundMetaTags(stream) dxDrawRectangle(x*346, y*198, x*537, y*550, tocolor(0, 0, 0, alpha2), false) dxDrawRectangle(x*346, y*198, x*537, y*74, tocolor(5, 239, 5, alpha2), false) dxDrawText("PAINEL DJ", x*500, y*220, x*732, y*252, tocolor(255, 255, 255, alpha), x*2.00, "default-bold", "center", "top", false, false, false, false, false) dxDrawText("X", x*831, y*220, x*864, y*252, tocolor(255, 255, 255, alpha), 2.00, "default-bold", "center", "center", false, false, false, false, false) if ismouseinposition (x*411, y*435, x*88, y*35) then dxDrawRectangle(x*411, y*435, x*88, y*35, tocolor(5, 239, 5, alpha3), false) else dxDrawRectangle(x*411, y*435, x*88, y*35, tocolor(5, 239, 5, alpha2), false) end if ismouseinposition (x*518, y*435, x*88, y*35) then dxDrawRectangle(x*518, y*435, x*88, y*35, tocolor(5, 239, 5, alpha3), false) else dxDrawRectangle(x*518, y*435, x*88, y*35, tocolor(5, 239, 5, alpha2), false) end if ismouseinposition (x*624, y*435, x*88, y*35) then dxDrawRectangle(x*624, y*435, x*88, y*35, tocolor(5, 239, 5, alpha3), false) else dxDrawRectangle(x*624, y*435, x*88, y*35, tocolor(5, 239, 5, alpha2), false) end if ismouseinposition (x*731, y*435, x*88, y*35) then dxDrawRectangle(x*731, y*435, x*88, y*35, tocolor(5, 239, 5, alpha3), false) else dxDrawRectangle(x*731, y*435, x*88, y*35, tocolor(5, 239, 5, alpha2), false) end dxDrawText("Volume -", x*411, y*435, x*499, y*470, tocolor(255, 255, 255, alpha), x*1.00, "default-bold", "center", "center", false, false, false, false, false) dxDrawText("Volume +", x*518, y*435, x*606, y*470, tocolor(255, 255, 255, alpha), x*1.00, "default-bold", "center", "center", false, false, false, false, false) dxDrawText("Tocar", x*624, y*435, x*712, y*470, tocolor(255, 255, 255, alpha), x*1.00, "default-bold", "center", "center", false, false, false, false, false) dxDrawText("Parar", x*731, y*435, x*819, y*470, tocolor(255, 255, 255, alpha), x*1.00, "default-bold", "center", "center", false, false, false, false, false) dxDrawRectangle(x*411, y*496, x*408, y*230, tocolor(0, 0, 0, alpha2), false) if not meta then dxDrawText("Duração: N/A", x*411, y*336, x*615, y*364, tocolor(255, 255, 255, alpha), x*1.00, "default-bold", "left", "center", false, false, false, false, false) dxDrawText("Tocando agora: N/A", x*411, y*283, x*819, y*308, tocolor(255, 255, 255, alpha), x*1.00, "default-bold", "left", "center", false, false, false, false, false) dxDrawText("Adicionado por: N/A", x*411, y*308, x*615, y*336, tocolor(255, 255, 255, alpha), x*1.00, "default-bold", "left", "center", false, false, false, false, false) dxDrawText("Volume: 00%", x*615, y*336, x*819, y*364, tocolor(255, 255, 255, alpha), x*1.00, "default-bold", "left", "center", false, false, false, false, false) end end function dx_2 () local meta = getSoundMetaTags(stream) if not meta then return end local duracao_musica = getSoundLength(stream) local anim = getSoundFFTData(stream, 8192, 30) local titulo = meta.title or meta.stream_title or "N/A" local msecs = duracao_musica*1000 local secs = msecs/1000 local duracao = string.format("%.2d:%.2d:%.2d",secs/(60*60),secs/60%60,secs%60) local volume = math.round ( getSoundVolume ( stream ), 2 ) if animON == true then dxDrawText("Tocando agora: "..titulo, x*411, y*283, x*819, y*308, tocolor(255, 255, 255, 255), x*1.00, "default-bold", "left", "center", true, false, false, false, false) dxDrawText("Duração: "..duracao, x*411, y*336, x*615, y*364, tocolor(255, 255, 255, 255), x*1.00, "default-bold", "left", "center", false, false, false, false, false) dxDrawText("Adicionado por: "..nome, x*411, y*308, x*615, y*336, tocolor(255, 255, 255, 255), x*1.00, "default-bold", "left", "center", false, false, false, true, false) dxDrawText("Volume: "..math.floor ( volume * 100 ).."%", x*615, y*336, x*819, y*364, tocolor(255, 255, 255, 255), x*1.00, "default-bold", "left", "center", false, false, false, false, false) for i,v in pairs(anim) do tamanho = math.round((v*320),0)>100 and 100 or math.round((v*320),0) largura = 13 dxDrawRectangle(x*418+(i*x*largura), y*720, x*largura-1, y*2*tamanho*-1, tocolor(5, 239, 5, 136), false) end end end -------------------------------- PLAYSOUND 3D addEvent ( "DestruiDJ", true ) addEventHandler ( "DestruiDJ", root, function ( who ) if ( isElement ( stream ) ) then destroyElement ( stream ) end end ) addEvent ( "VolumeDJ", true ) addEventHandler ( "VolumeDJ", root, function ( who, vol ) if ( isElement ( stream ) ) then setSoundVolume ( stream, tonumber ( vol ) ) end end ) addEvent ( "CrioDJ", true ) addEventHandler ( "CrioDJ", root, function ( who, Link, isCar ) if ( isElement ( stream ) ) then destroyElement ( stream ) end local x, y, z = getElementPosition ( who ) stream = playSound3D ( Link, x, y, z, true ) setSoundVolume ( stream, 1 ) setSoundMinDistance (stream, 50 ) setSoundMaxDistance ( stream, 50 ) end ) function tocar(_,estado) if dj == true then if estado == "down" then if ismouseinposition(x*624, y*435, x*88, y*35) then setTimer ( function() local meta = getSoundMetaTags(stream) local duracao_musica = getSoundLength(stream) local titulo = meta.title or meta.stream_title or "N/A" local msecs = duracao_musica*1000 local secs = msecs/1000 local duracao = string.format("%.2d:%.2d:%.2d",secs/(60*60),secs/60%60,secs%60) outputChatBox ( "#FFFFFF==> #00FF00Música#FFFFFF: "..titulo.." = #00FF00Duração: #FFFFFF"..duracao..".", 255, 255, 255 ,true) end, 2000, 1 ) triggerServerEvent ( "CrioDJ", localPlayer, guiGetText ( Link )) addEventHandler("onClientRender",root,dx_2) playSoundFrontEnd(1) isSound = true animON = true end end end end addEventHandler("onClientClick",root,tocar) function Parar(_,estado) if dj == true then if estado == "down" then if ismouseinposition(x*731, y*435, x*88, y*35) then triggerServerEvent ( "DestruiDJ", localPlayer ) outputChatBox ( "#FFFFFF==> #00FF00Você cancelo a repodrução da musica atual.", 255, 255, 255 ,true) removeEventHandler ("onClientRender", root, dx_2) playSoundFrontEnd(2) isSound = false animON = false end end end end addEventHandler("onClientClick",root,Parar) function Volumemenos(_,estado) if dj == true then if estado == "down" then if ismouseinposition(x*411, y*435, x*88, y*35) then playSoundFrontEnd(3) if ( isSound ) then local volume = math.round ( getSoundVolume ( stream ) - volume_menos, 2 ) if ( volume > 0.0 ) then triggerServerEvent ( "VolumealteradoDJ", localPlayer, volume ) --outputChatBox ( "#FFFFFF==> #00FF00Volume alterado para "..math.floor ( volume * 100 ).."%.", 0, 255, 255 ,true) else outputChatBox ( "#FFFFFF==> #00FF00DJ está no volume minimo.", 0, 255, 255 ,true) end end end end end end addEventHandler("onClientClick",root,Volumemenos) function Volumemais(_,estado) if dj == true then if estado == "down" then if ismouseinposition(x*518, y*435, x*88, y*35) then playSoundFrontEnd(3) if ( isSound ) then local volume = math.round ( getSoundVolume ( stream ) + volume_mais, 2 ) if ( volume < 1.1 ) then triggerServerEvent ( "VolumealteradoDJ", localPlayer, volume ) --outputChatBox ( "#FFFFFF==> #00FF00Volume alterado para "..math.floor ( volume * 100 ).."%.", 0, 255, 255 ,true) else outputChatBox ( "#FFFFFF==> #00FF00DJ está no volume maximo.", 0, 255, 255 ,true) end end end end end end addEventHandler("onClientClick",root,Volumemais) function fechar(_,estado) if dj == true then if estado == "down" then if ismouseinposition(x*831, y*220, x*53, y*37) then playSoundFrontEnd(5) showCursor(false) removeEventHandler("onClientRender",root,dx) removeEventHandler ("onClientRender", root, dx_2) guiSetVisible ( Link, false ) dj = false animON = false end end end end addEventHandler("onClientClick",root,fechar) function dj_add (djay_painel) nome=djay_painel; end addEvent ("Djay",true) addEventHandler ("Djay",root,dj_add) function mostrarpainelDJ () if dj == false then addEventHandler ("onClientRender", root, dx) djt = getTickCount() guiSetVisible ( Link, true ) addEventHandler("onClientRender",root,dx_2) animON = true showCursor (true) dj = true else removeEventHandler ("onClientRender", root, dx) guiSetVisible ( Link, false ) showCursor (false) dj = false animON = false end end addEvent ("Dj",true) addEventHandler ("Dj",root,mostrarpainelDJ) function math.round(number, decimals, method) decimals = decimals or 0 local factor = 10 ^ decimals if (method == "ceil" or method == "floor") then return math[method](number * factor) / factor else return tonumber(("%."..decimals.."f"):format(number)) end end function ismouseinposition ( x, y, width, height ) if ( not isCursorShowing ( ) ) then return false end local sx, sy = guiGetScreenSize ( ) local cx, cy = getCursorPosition ( ) local cx, cy = ( cx * sx ), ( cy * sy ) if ( cx >= x and cx <= x + width ) and ( cy >= y and cy <= y + height ) then return true else return false end end