adwyer434 Posted December 11, 2015 Share Posted December 11, 2015 Hello I am trying to use "lFalke" Resource Crying Witch on my MTA DayZ Server Iv'e tried to change the witched damage from Health/HP to Blood but can't seem to get her to kill me Any ideas? Thanks Azza Server Side --[[ ########################################################################## ## ## ## COMPLETE VERSION ## ## Project: 'Witch of L4D 2' - resource for MTA: San Andreas ## ## ## ########################################################################## [C] Copyright 2013-2014, Falke and [COD]Plate ]] RealWitch = nil function findRotation(x1,y1,x2,y2) local t = -math.deg(math.atan2(x2-x1,y2-y1)) if t < 0 then t = t + 360 end; return t; end function getPointFromDistanceRotation(x, y, dist, angle) local a = math.rad(90 - angle); local dx = math.cos(a) * dist; local dy = math.sin(a) * dist; return x+dx, y+dy; end Witch = nil function getPlayerNearestToPosition(x, y, z) local nearestPlayer = nil local nearestDistance = nil for i, players in ipairs(getElementsByType("player")) do local px, py, pz = getElementPosition(players) local distance = getDistanceBetweenPoints3D(px, py, pz, x, y, z) if nearestPlayer == nil then nearestPlayer = players nearestDistance = distance elseif distance < nearestDistance then nearestDistance = distance nearestPlayer = players end end if nearestPlayer == nil then return false else return nearestPlayer end end function Boss () blip = {} local localPed = createPed( 33, 2952, -1933, 1.4 ) local health = exports.extra_health:setElementExtraHealth ( localPed, 1500 ) setElementModel ( localPed, 33 ) setPedAnimation(localPed, "CRACK", "crckidle3", -1, true, true, false) setElementData(localPed, "type", "RealWitch") setPedStat(localPed, 24, 1000) RealWitch = localPed blip[1] = (createBlipAttachedTo ( localPed, 0 )) triggerClientEvent ( "witchsound", root ) setElementData(localPed, "currenthealth", exports.extra_health:getElementExtraHealth(RealWitch)) setElementData(localPed, "Witch", true) end addEventHandler("onResourceStart", resourceRoot, Boss) addEvent("onWitchReady", true) addEvent("witchatack", true) addEventHandler ( "witchatack", root, function ( ) local Health = exports.extra_health:getElementExtraHealth(localPed) if Health < 1499 or Health == 1499 then setPedAnimation(localPed, "ped", "sprint_Wuzi", -1, true, true, false) triggerClientEvent ( "chillido", root ) end end ) addEvent("witchatackxd", true) addEventHandler ( "witchatackxd", root, function ( ) setPedAnimation(localPed, "ped", "sprint_Wuzi", -1, true, true, false) end ) addEventHandler("onPedWasted", getRootElement(), function(ammo, killer) if isElement(RealWitch) then if source == RealWitch then local x, y, z = getElementPosition(RealWitch) destroyElement(RealWitch) destroyElement(blip[1]) setTimer(Boss, 30000, 1) triggerClientEvent ( "chillido", root ) end end end ) setTimer( function() localPed = RealWitch if isElement(RealWitch) then local x, y, z = getElementPosition(RealWitch) local player = getPlayerNearestToPosition(x, y, z) if player then local px, py, pz = getElementPosition(player) if getDistanceBetweenPoints3D(x, y, z, px, py, pz) < 130 then if isElementInWater(RealWitch) then setPedAnimation(RealWitch, "CRACK", "crckidle3", -1, true, true, false) local healthxd = exports.extra_health:setElementExtraHealth ( RealWitch, 1500 ) end local rotZ = findRotation(x, y, px, py) setPedRotation(RealWitch, rotZ) if getDistanceBetweenPoints3D(px, py, pz, x, y, z) < 2 then local health = getElementHealth(player) if health < 5 or health == 5 then setElementHealth(player, 0) local leX, leY, leZ = getElementPosition(RealWitch) setPedAnimation(RealWitch, "CRACK", "crckidle3", -1, true, true, false) local healthxd = exports.extra_health:setElementExtraHealth ( RealWitch, 1500 ) else setElementHealth(player, health - 6) end end else local healthxd = exports.extra_health:setElementExtraHealth ( RealWitch, 1500 ) setPedAnimation(RealWitch, "CRACK", "crckidle3", -1, true, true, false) end end end end , 50, 0) addEvent("killdmgzero",true) function killWhenHpZero(source,attacker,weapon,bodypart) killPed(source,attacker,weapon,bodypart) end addEventHandler("killdmgzero",root,killWhenHpZero) Client Side --[[ ########################################################################## ## ## ## COMPLETE VERSION ## ## Project: 'Witch of L4D 2' - resource for MTA: San Andreas ## ## ## ########################################################################## [C] Copyright 2013-2014, Falke and [COD]Plate ]] local cFunc = {} local cSetting = {} cFunc["witch_atack"] = function(_, wep, bodypart) if not getElementData(source, "Damaged") then local weaponType = getPedWeapon ( getLocalPlayer() ) if(wep == weaponType) then triggerServerEvent ( "witchatack", root ) setSoundMaxDistance(witchcry, 0) setElementData(source, "Damaged", true) end end end addEventHandler("onClientPedDamage", getRootElement(),cFunc["witch_atack"]) cFunc["witch_atackxd"] = function(_, wep, bodypart) local weaponType = getPedWeapon ( getLocalPlayer() ) if(wep == weaponType) then triggerServerEvent ( "witchatackxd", root ) end end addEventHandler("onClientPedDamage", getRootElement(),cFunc["witch_atackxd"]) addEvent ( "chillido", true ) addEventHandler ( "chillido", root, function ( ) playSound ( "tawa.mp3" ) end ) function startMusic() setRadioChannel(0) song = playSound3D("cry.mp3", -175.610, 57.66, 3.2, true) setSoundMaxDistance(song, 180) end function cancelPedDamage ( attacker, weapon, bodypart ) if getElementType ( source ) == "ped" then if (getElementData (source, "Witch") == true) then local zhp = getElementData(source,"currenthealth") if zhp > 0 then local dmg = 25 local takedamage = zhp - dmg setElementData(source,"currenthealth",takedamage) elseif zhp == 0 then triggerServerEvent("killdmgzero",root,source,attacker,weapon,bodypart) end end end end addEventHandler ( "onClientPedDamage", getRootElement(), cancelPedDamage ) function toggleSong() setSoundVolume(song,0) end addEventHandler("onClientPedDamage",getRootElement(),toggleSong) addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),startMusic) addEvent ( "witchsound", true ) addEventHandler ( "witchsound", root, function ( ) song = playSound3D("cry.mp3", 2952, -1925, 4.2, true) setSoundMaxDistance(song, 180) end ) local maxDist = 30 function witchNameTag() local witchs = getElementsByType ( "ped",getRootElement(),true ) local Px,Py,Pz = getCameraMatrix( ) for theKey,theWitch in ipairs(witchs) do if (isElement(theWitch)) then local Zx,Zy,Zz = getElementPosition( theWitch ) local zhx,zhy,zhz = getPedBonePosition(theWitch,6) if (getDistanceBetweenPoints3D(Px, Py, Pz, Zx, Zy, Zz) < maxDist ) then if (getElementData (theWitch, "Witch") == true) then local sxx,syy = getScreenFromWorldPosition(zhx,zhy,zhz+0.3) local currentDistance = getDistanceBetweenPoints3D(Px, Py, Pz, Zx, Zy, Zz) --local zombieHealth = getElementHealth(theWitch) local maxHP = exports.extra_health:getElementExtraHealth(theWitch) local currentHealth = getElementData(theWitch, "currenthealth") if sxx and getElementHealth(theWitch) > 0 then sx,sy = sxx-60,syy-10 dxDrawRectangle(sx+5,sy+25,131.0/maxHP*currentHealth,12.0,tocolor(255,0,0,200),false) -- health dxDrawRectangle(sx,sy,146.0,46.0,tocolor(0,0,0,0),false) -- background dxDrawRectangle(sx+5,sy+25,131.0,12.0,tocolor(0,0,0,100),false) -- bg health dxDrawText("Witch",sx+26,sy,596.0,236.0,tocolor(255,0,0,255),1.0,"default","left","top",false,false,false) -- z name end end end end end end addEventHandler("onClientRender", root, witchNameTag) Link to comment
adwyer434 Posted December 12, 2015 Author Share Posted December 12, 2015 Can anyone at all help me with this?! 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