Ahmet isimli oyuncu Mehmet tarafından "(M4) Kullandığı Silahı" ile öldürüldü. Bu şekilde ayarlayabilir misiniz Lütfen.?
function kilLDayZPlayer(killer,headshot,weapon)
pedCol = false
local account = getPlayerAccount(source)
if not account then
return
end
killPed(source)
triggerClientEvent(source,"hideInventoryManual",source)
if getAccountData(account,"dontShowBody") == true then
setAccountData(account,"dontShowBody",false)
return
end
if getElementData(source,"alivetime")> 10 and not isElementInWater(source) then
local x,y,z = getElementPosition(source)
if getDistanceBetweenPoints3D(x,y,z,6000,6000,0)> 200 then
local x,y,z = getElementPosition(source)
local rotX,rotY,rotZ = getElementRotation(source)
local skin = getElementModel(source)
local ped = createPed(skin,x,y,z,rotZ)
if headshot then
setPedHeadless(ped,true)
end
triggerClientEvent("AddDeathPedClothes",source,ped,source)
pedCol = createColSphere(x,y,z,1.5)
killPed(ped)
setTimer(destroyDeadPlayer,2700000,1,ped,pedCol)
attachElements(pedCol,ped,0,0,0)
setElementData(pedCol,"parent",ped)
setElementData(pedCol,"playername",getPlayerName(source))
setElementData(pedCol,"deadman",true)
setElementData(pedCol,"MAX_Slots",getElementData(source,"MAX_Slots"))
local time = getRealTime()
local hours = time.hour
local minutes = time.minute
setElementData(pedCol,"deadreason",getPlayerName(source).." is dead. Killer: "..(getPlayerName(killer) or "Unknown")..". Time of death: "..hours..":"..minutes)
end
end
if killer then
if not getElementData(source,"bandit") then
addPlayerStats(killer,"humanity",math.random(-2500,-1000))
else
addPlayerStats(killer,"humanity",math.random(1000,2500))
end
setElementData(killer,"murders",getElementData(killer,"murders")+ 1)
if 0 > getElementData(killer,"humanity") then
setElementData(killer,"bandit",true)
end
if getElementData(source,"bandit")== true then
setElementData(killer,"banditskilled",getElementData(killer,"banditskilled")+ 1)
end
if headshot == true then
setElementData(killer,"headshots",getElementData(killer,"headshots")+ 1)
end
end
if pedCol then
for i,data in ipairs(playerDataTable)do
if tonumber(getElementData(source,data[1]))then
setElementData(pedCol,data[1],getElementData(source,data[1]))
end
end
if getActiveVest(source) and getElementData(source,"vestLife") == getVestLife(getActiveVest(source)) then
setElementData(pedCol,getActiveVest(source),1)
end
if getActiveHelmet(source) and getElementData(source,"helmetLife") == getHelmetLife(getActiveHelmet(source)) then
setElementData(pedCol,getActiveHelmet(source),1)
end
--[[local skinID = getElementData(source,"skin")
local skin = getSkinNameFromID(skinID)
setElementData(pedCol,skin,1)]]
--[[local backpackSlots = getElementData(source,"MAX_Slots") Backpack não some do inv
backpackName = getBackpackName(backpackSlots)
if backpackName then
setElementData(pedCol,backpackName,1)
end]]
end
setTimer(setElementPosition,500,1,source,6000,6000,0)
triggerClientEvent(source,"onClientPlayerDeathInfo",source)
setAccountData(account,"isDead",true)
setElementData(source,"isDead",true)
triggerClientEvent("onRollMessageStart",getRootElement(),"#FFFFFF"..getPlayerName(source).." #FFFFFFwas killed",0,22,255,"died")
destroyElement(getElementData(source,"playerCol"))
setTimer(spawnDayZPlayer,5000,1,source)
end
addEvent("kilLDayZPlayer",true)
addEventHandler("kilLDayZPlayer",getRootElement(),kilLDayZPlayer)