Arcanjo Miguel Posted December 19, 2021 Share Posted December 19, 2021 (edited) Ola eu gostaria de saber se e possivel assim que o cara for atingido pela arma do id 24 ela caise do veiculo com a animação especificada com uma espece de bloqueador de tecla que assim que o player for atingido ela n consigo apertar nenhum botão pra n cortar animação tipo bloquear o W,S,A,D,F1,F2 . i assim por diante. Se não tiver uma maneira de retirar o alvo do veiculo ao ser atingido ficarei grato se podesse me ajudar pelo menos no bloque mesmo. desde ja agradeço. --serv.lua: addEventHandler("onPlayerWeaponFire", root, function (weapon, endX, endY, endZ, hitElement, startX, startY, startZ) local weaponType = getPlayerWeapon (source) if weaponType == 24 then local x,y,z = getElementPosition(source) if (isElement(hitElement) and getElementType(hitElement) == "player") then local hx,hy,hz = getElementPosition(hitElement) else local hx,hy,hz = endX, endY, endZ end for key, value in ipairs(getElementsByType("player")) do local px, py, pz = getElementPosition(value) local distance = getDistanceBetweenPoints3D(x, y, z, px, py, pz) if distance < 16 then triggerClientEvent(value, "fire_effect", root, source, hitElement, weapon, endX, endY, endZ) print("tiro") end end end end) for key, value in ipairs(getElementsByType("player")) do toggleControl ( value, "fire", true ) setElementData(value, "teaser:caido", false) setPedAnimation(value) end addEvent("teaser_letal", true ) addEventHandler("teaser_letal", getRootElement(), function () if not (getElementData(source, "teaser:caido")) then setElementData(source, "teaser:caido", true) setTimer(setElementData, 15000, 1, source, "teaser:caido", false) setElementFrozen(source, true) setTimer(setElementFrozen, 14000, 1, source, false) setPedAnimation(source, "ped", "KO_shot_stom", -1, false, false, true) setTimer(setPedAnimation, 15000, 1, source) end end) client.lua local iRechargeDelay = 10000 local iHitWiresBlinkDuration = 5000 local iMissWiresBlinkDuration = 100 local iDisableDuration = 15000 local iMaxDistance = 14 local iLastShot = 0 local iLastHit = 0 local pTaserSound = nil local pHeartbeatSound = nil local pTaserShotsAround = {} local pWakeUpTimer = {} local fProgress = 0 local pTaserBeamMaterial = dxCreateTexture("files/img/beam.png") local pBlockedControlsList = { "jump","cursor", "forwards", "backwards", "left", "right", "previous_weapon", "next_weapon", "aim_weapon", } addEventHandler("onClientKey", root, function(button, press) local theVehicle = getPedOccupiedVehicle ( localPlayer ) if theVehicle then if (button == "lctrl" or button == "rctrl") then cancelEvent() end end end) function timerIn () if not fProgress then fProgress = 0 end fProgress = fProgress + 1 if fProgress > 100 then killTimer(execTimer) fProgress = false removeEventHandler( "onClientRender", root, DrawTaserCharge) end end function DrawTaserCharge() local tx, ty, tz = getPedTargetStart(localPlayer) local sx, sy = getScreenFromWorldPosition( tx, ty, tz ) if sx and sy then if tonumber((fProgress or 0) > 100) then removeEventHandler( "onClientRender", root, DrawTaserCharge) end if (fProgress >= 1) then end end end addEvent("fire_effect", true ) addEventHandler("fire_effect", getRootElement(), function (attack, vitima, weapons, fx, fy, fz) if attack then if weapons then local shot_data = { started = getTickCount(), source = attack, target = vitima, fix = fx, fiy = fy, fiz = fz, } table.insert(pTaserShotsAround, shot_data) if #pTaserShotsAround == 1 then addEventHandler( "onClientRender", root, dxFio) end end end if localPlayer == vitima then if isElement(viSound) then stopSound(viSound) end viSound = playSound( "files/sound/heartbeat.mp3") setTimer(stopSound, 20000, 1, viSound) triggerServerEvent("teaser_letal", localPlayer, localPlayer) end if attack == localPlayer then toggleControl("fire", false) setTimer(toggleControl, 12000, 1, "fire", true) execTimer = setTimer(timerIn, 100, 0) fProgress = 0 addEventHandler( "onClientRender", root, DrawTaserCharge) end if isElement(pTaserSound) then stopSound(pTaserSound) end x,y,z = getElementPosition(attack) pTaserSound = playSound3D( "files/sound/taser.mp3", x,y,z ) end) addEvent("cancel_effect", true ) addEventHandler("cancel_effect", getRootElement(), function () if isElement(pTaserSound) then stopSound(pTaserSound) end removeEventHandler( "onClientRender", root, dxFio) print("Som desativado") end) function dxFio () if #pTaserShotsAround == 0 then removeEventHandler( "onClientRender", root, dxFio) end for i, shot in pairs(pTaserShotsAround) do if getPedWeapon(shot.source) == 24 then local x,y,z = getPedWeaponMuzzlePosition( shot.source ) if isElement(shot.target) then local vx,vy,vz = getElementPosition(shot.target) end for i=1,3 do local vecRandBias = Vector3( math.random(1,1)/10, math.random(1,1)/10, math.random(1,1)/10 ) if getElementType(shot.target) == "player" then local tx,ty,tz = getPedBonePosition( shot.target, 2 ) dxDrawMaterialLine3D( x,y,z, Vector3(tx,ty,tz)+vecRandBias, pTaserBeamMaterial, 0.01 ) print("Type1 ") else dxDrawMaterialLine3D( x,y,z, Vector3(shot.fix,shot.fiy,shot.fiz)+vecRandBias, pTaserBeamMaterial, 0.01 ) print("Type2 ") end end if getTickCount() - shot.started >= iHitWiresBlinkDuration then if shot.source == localPlayer then toggleControl( "aim_weapon", true ) end table.remove(pTaserShotsAround, i) end else if getTickCount() - shot.started >= iMissWiresBlinkDuration then table.remove(pTaserShotsAround, i) end end end end function cancelTazerDamage(attacker, weapon, bodypart, loss) if (weapon==24) then cancelEvent() end end addEventHandler("onClientPlayerDamage", localPlayer, cancelTazerDamage) local txd = engineLoadTXD ( "files/mdl/taser.txd" ) engineImportTXD ( txd, 348 ) local dff = engineLoadDFF ( "files/mdl/taser.dff" ) engineReplaceModel ( dff, 348 ) Edited December 20, 2021 by Lord Henry Códigos convertidos de texto para Lua. Link to comment
Other Languages Moderators Lord Henry Posted December 20, 2021 Other Languages Moderators Share Posted December 20, 2021 Olá, na próxima vez utilize o botão <> do fórum para postar códigos. Não cole direto no texto. Link to comment
Arcanjo Miguel Posted December 21, 2021 Author Share Posted December 21, 2021 Poxa perdão mas vc pode me ajuda eu so queria um block tec mesmo Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now