[YARDIM] Spawn Silah Sorunu

0 Üye ve 1 Ziyaretçi konuyu incelemekte.

Çevrimdışı ardaabo

  • Acemi Üye
  • *
    • İleti: 145
: 28 Aralık 2018, 14:10:49
Oyuncu elindeki silah ile öldüğünde sırtında silah ile spawnlanıyor, bunun için bir çözüm bilen var mı lütfen.



Spoiler for Hiden:


Spoiler for Hiden:
function spawnDayZPlayer(player)
    local number = math.random(table.size(spawnPositions))
    local x,y,z = spawnPositions[number][1],spawnPositions[number][2],spawnPositions[number][3]
    spawnPlayer (player, x,y,z+0.5, math.random(0,360), 73, 0, 0)
    fadeCamera (player, true)
    setCameraTarget (player, player)
        playerCol = createColSphere(x,y,z,1.5)
        setElementData(player,"playerCol",playerCol)
        attachElements ( playerCol, player, 0, 0, 0 )
        setElementData(playerCol,"parent",player)
        setElementData(playerCol,"player",true)
        local account = getPlayerAccount(player)
        setAccountData(account,"isDead",false)
        setElementData(player,"isDead",false)
        setElementData(player,"logedin",true)
        setElementData(player,"admin",getAccountData(account,"admin") or false)
        setElementData(player,"supporter",getAccountData(account,"supporter") or false)
    ----------------------------------
    --Player Items on Start
    for i,data in ipairs(playerDataTable) do
        if data[1] =="Bandage" then
            setElementData(player,data[1],2)   
        elseif data[1] =="Painkiller" then
            setElementData(player,data[1],1)     
        elseif data[1] =="GPS" then
            setElementData(player,data[1],1)
      elseif data[1] =="Map" then
            setElementData(player,data[1],1)         
        elseif data[1] =="MAX_Slots" then
            setElementData(player,data[1],8)   
        elseif data[1] =="skin" then
            setElementData(player,data[1],73)
        elseif data[1] =="blood" then
            setElementData(player,data[1],12000)
        elseif data[1] =="temperature" then
            setElementData(player,data[1],37)
        elseif data[1] =="brokenbone" then
            setElementData(player,data[1],false)   
        elseif data[1] =="pain" then
            setElementData(player,data[1],false)
        elseif data[1] =="cold" then
            setElementData(player,data[1],false)
        elseif data[1] =="infection" then
            setElementData(player,data[1],false)
        elseif data[1] =="food" then
            setElementData(player,data[1],100)
        elseif data[1] =="thirst" then
            setElementData(player,data[1],100)
        elseif data[1] =="currentweapon_1" then
            setElementData(player,data[1],false)
        elseif data[1] =="currentweapon_2" then
            setElementData(player,data[1],false)   
        elseif data[1] =="currentweapon_3" then
            setElementData(player,data[1],false)   
        elseif data[1] =="bandit" then
            setElementData(player,data[1],false)   
        elseif data[1] =="humanity" then
            setElementData(player,data[1],2500)
        else
            setElementData(player,data[1],0)
        end     
    end
    ----------------------------------
end
--addEvent("onPlayerLoginToDayZ",true)
--addEventHandler("onPlayerLoginToDayZ",getRootElement(),spawnDayZPlayer)
--addEventHandler("onPlayerJoin",getRootElement(),spawnDayZPlayer)

function checkBuggedAccount()
    for i,player in ipairs(getElementsByType("player")) do
        local account = getPlayerAccount(player)
        if not account then return end
        if getElementData(player,"logedin") then
            if getElementModel(player) == 0 then
                spawnDayZPlayer(player)
                outputChatBox(getPlayerName(player).."s Account is buggy and has been reset.",getRootElement(),22,255,22,true)
            end
        end
    end
end
setTimer(checkBuggedAccount,90000,0)

function notifyAboutExplosion2()
    for i,player in pairs(getVehicleOccupants(source)) do
        triggerEvent("kilLDayZPlayer",player)
    end
end
addEventHandler("onVehicleExplode", getRootElement(), notifyAboutExplosion2)

function destroyDeadPlayer (ped,pedCol)
    destroyElement(ped)
    destroyElement(pedCol)
end

function kilLDayZPlayer (killer,headshot,weapon)
pedCol = false
local account = getPlayerAccount(source)
--if getElementData(source,"isInEvent") then removePlayerEvent(source) return end
if not account then return end
    killPed(source)
    triggerClientEvent(source,"hideInventoryManual",source)
    if getElementData(source,"alivetime") > 10 then
    if 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)
        pedCol = createColSphere(x,y,z,1.5)
        killPed(ped)
        setTimer(destroyDeadPlayer,3600000*0.75,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. Cause of death: "..(weapon or "Unknown")..". Time of death: "..hours..":"..minutes.." o'clock.")
    end
    end
    end
        if killer then
        if not getElementData(source,"bandit") then
            addPlayerStats (killer,"humanity",math.random(-2500,-1000))
         setElementData(killer,"experience",getElementData(killer,"experience")+70)
        else
            addPlayerStats (killer,"humanity",math.random(1000,2500))
         setElementData(killer,"experience",getElementData(killer,"experience")+70)
        end
        setElementData(killer,"murders",getElementData(killer,"murders")+1)
      setElementData(killer,"experience",getElementData(killer,"experience")+70)
        if getElementData(killer,"humanity") < 0 then
            setElementData(killer,"bandit",true)
        end
        if getElementData(source,"bandit") == true then
            setElementData(killer,"banditskilled",getElementData(killer,"banditskilled")+1)
         setElementData(killer,"experience",getElementData(killer,"experience")+70)
        end
        if headshot == true then
            setElementData(killer,"headshots",getElementData(killer,"headshots")+1)
         setElementData(killer,"experience",getElementData(killer,"experience")+70)
        end
        end
      if killer then
      local silah = getWeaponNameFromID(getPedWeapon(killer))
      triggerClientEvent ( "onRollMessageStart", getRootElement()," "..getPlayerName(source).." #FFFFFFwas killed by "..getPlayerName(killer).." with "..silah..".", 255,255,255, "died")
       else
      triggerClientEvent ( "onRollMessageStart", getRootElement()," "..getPlayerName(source).." #FFFFFFis dead.",255,255,255, "died")
       end
        --SetElementDatas
    if pedCol then
        for i,data in ipairs(playerDataTable) do
            local plusData = getElementData(source,data[1])
            if data[1] == "M1911 Mag" then
                plusData = math.floor(getElementData(source,data[1])/7)
            elseif data[1] == "M9 SD Mag" then
                plusData = math.floor(getElementData(source,data[1])/15)
            elseif data[1] == "Desert Eagle Mag" then
                plusData = math.floor(getElementData(source,data[1])/7)
            elseif data[1] == "PDW Mag" then
                plusData = math.floor(getElementData(source,data[1])/30)
            elseif data[1] == "MP5A5 Mag" then
                plusData = math.floor(getElementData(source,data[1])/20)
            elseif data[1] == "AK Mag" then
                plusData = math.floor(getElementData(source,data[1])/30)
            elseif data[1] == "M4 Mag" then
                plusData = math.floor(getElementData(source,data[1])/20)
            elseif data[1] == "CZ 550 Mag" then
                plusData = math.floor(getElementData(source,data[1])/5)
            elseif data[1] == "Lee Enfield Mag" then
                plusData = math.floor(getElementData(source,data[1])/10)
            elseif data[1] == "1866 Slug" then
                plusData = math.floor(getElementData(source,data[1])/7)
            elseif data[1] == "SPAZ-12 Pellet" then
                plusData = math.floor(getElementData(source,data[1])/7)
            elseif data[1] == "2Rnd. Slug" then
                plusData = math.floor(getElementData(source,data[1])/2)
            end
            setElementData(pedCol,data[1],plusData)
        end
        --Skin
        local skinID = getElementData(source,"skin")
        local skin = getSkinNameFromID(skinID)
        setElementData(pedCol,skin,1)
        --Backpack
        local backpackSlots = getElementData(source,"MAX_Slots")
        if backpackSlots == 12 then
            setElementData(pedCol,"Assault Pack (ACU)",1)
        elseif backpackSlots == 16 then
            setElementData(pedCol,"Alice Pack",1)
        elseif backpackSlots == 26 then
            setElementData(pedCol,"Coyote Backpack",1)
        elseif backpackSlots == 50 then
            setElementData(pedCol,"Czech Backpack",1)
        elseif backpackSlots == 60 then
            setElementData(pedCol,"Ghillie Backpack",1)
        elseif backpackSlots == 70 then
            setElementData(pedCol,"OS Backpack",1)
        elseif backpackSlots == 90 then
            setElementData(pedCol,"Legendary Backpack",1)
        end
    end
        setTimer(setElementPosition,500,1,source,6000,6000,0)
        triggerClientEvent(source,"onClientPlayerDeathInfo",source)
        setAccountData(account,"isDead",true)
        setElementData(source,"isDead",true)
      if getElementData(source,"playerCol") then
         if isElement(getElementData(source,"playerCol")) then
            destroyElement(getElementData(source,"playerCol"))
         end
      end
        setTimer(spawnDayZPlayer,5000,1,source)
end
addEvent("kilLDayZPlayer",true)
addEventHandler("kilLDayZPlayer",getRootElement(),kilLDayZPlayer)
« Son Düzenleme: 08 Ocak 2019, 07:57:04 Gönderen: Narkoz »
 


MTASATURK

[YARDIM] Spawn Silah Sorunu
« : 28 Aralık 2018, 14:10:49 »