Advertisement
Nelsonnn

Untitled

Nov 7th, 2018
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 14.42 KB | None | 0 0
  1. local spawnPositions = {
  2.     {-278.6669921875,-2882.1572265625,32.104232788086},
  3.     {-958.5595703125,-2887.9912109375,64.82421875},
  4.     {-1816.9375,-2748.18359375,1.7327127456665},
  5.     {-2816.166015625,-2439.0546875,2.4004096984863},
  6.     {-2941.5673828125,-1206.2373046875,2.7848854064941},
  7.     {-2911.51171875,-895.22265625,2.4013109207153},
  8.     {-2185.6669921875,2957.380859375,11.474840164185},
  9.     {272.2265625,2928.505859375,1.3713493347168},
  10.     {2803.943359375,595.9365234375,7.7612648010254},
  11.     {2883.7509765625,-178.4658203125,3.2714653015137},
  12.     {-233.46484375,-1735.8173828125,1.5520644187927},
  13.     {-1056.8720703125,2939.068359375,42.311294555664},
  14. }
  15.  
  16. local playerDataTable = {
  17.     {"alivetime"},
  18.     {"skin"},
  19.     {"MAX_Slots"},
  20.     {"bandit"},
  21.     {"blood"},
  22.     {"food"},
  23.     {"thirst"},
  24.     {"temperature"},
  25.     {"currentweapon_1"},
  26.     {"currentweapon_2"},
  27.     {"currentweapon_3"},
  28.     {"bleeding"},
  29.     {"brokenbone"},
  30.     {"pain"},
  31.     {"cold"},
  32.     {"infection"},
  33.     {"humanity"},
  34.     {"zombieskilled"},
  35.     {"headshots"},
  36.     {"murders"},
  37.     {"banditskilled"},
  38.     {"Wood Pile"},
  39.     {"Bandage"},
  40.     {"Water Bottle"},
  41.     {"Pasta Can"},
  42.     {"Beans Can"},
  43.     {"Burger"},
  44.     {"Box of Matches"},
  45.     {"M1911 Mag"},
  46.     {"M9 SD Mag"},
  47.     {"Desert Eagle Mag"},
  48.     {"M1911"},
  49.     {"M9 SD"},
  50.     {"Winchester 1866"},
  51.     {"PDW"},
  52.     {"Hunting Knife"},
  53.     {"Hatchet"},
  54.     {"Pizza"},
  55.     {"Morphine"},
  56.     {"Soda Bottle"},
  57.     {"Empty Gas Canister"},
  58.     {"Full Gas Canister"},
  59.     {"Roadflare"},
  60.     {"Milk"},
  61.     {"PDW Mag"},
  62.     {"MP5A5 Mag"},
  63.     {"AK Mag"},
  64.     {"M4 Mag"},
  65.     {"Tear Gas"},
  66.     {"Grenade"},
  67.     {"Desert Eagle"},
  68.     {"Sawn-Off Shotgun"},
  69.     {"SPAZ-12 Combat Shotgun"},
  70.     {"MP5A5"},
  71.     {"Watch"},
  72.     {"Medic Kit"},
  73.     {"Heat Pack"},
  74.     {"Lee Enfield"},
  75.     {"PDW"},
  76.     --{"TEC-9"},
  77.     {"AK-47"},
  78.     --{"M136 Rocket Launcher"},
  79.     {"Blood Bag"},
  80.     {"GPS"},
  81.     {"Map"},
  82.     {"Toolbox"},
  83.     {"Wire Fence"},
  84.     {"Tire"},
  85.     {"Engine"},
  86.     {"Tank Parts"},
  87.     --{"M136 Rocket"},
  88.     {"CZ 550 Mag"},
  89.     {"Lee Enfield Mag"},
  90.     {"M4"},
  91.     {"CZ 550"},
  92.     --{"Heat-Seeking RPG"},
  93.     {"Satchel"},
  94.     {"Infrared Goggles"},
  95.     {"Night Vision Goggles"},
  96.     {"Tent"},
  97.     {"Raw Meat"},
  98.     {"Cooked Meat"},
  99.     {"Camouflage Clothing"},
  100.     {"Ghillie Suit"},
  101.     {"Civilian Clothing"},
  102.     {"Survivor Clothing"},
  103.     {"Painkiller"},
  104.     {"Empty Water Bottle"},
  105.     {"Empty Soda Cans"},
  106.     {"Scruffy Burgers"},
  107.     {"1866 Slug"},
  108.     {"2Rnd. Slug"},
  109.     {"SPAZ-12 Pellet"},
  110.     {"Radio Device"},
  111.     {"Binoculars"},
  112.     {"Baseball Bat"},
  113.     {"Shovel"},
  114.     {"Golf Club"},
  115.     {"Assault Pack (ACU)"},
  116.     {"Alice Pack"},
  117.     {"Czech Backpack"},
  118.     {"Coyote Backpack"},
  119. }
  120.  
  121. local vehicleDataTable = {
  122.     {"MAX_Slots"},
  123.     {"Tire_inVehicle"},
  124.     {"Engine_inVehicle"},
  125.     {"Parts_inVehicle"},
  126.     {"fuel"},
  127.     {"Wood Pile"},
  128.     {"Bandage"},
  129.     {"Water Bottle"},
  130.     {"Pasta Can"},
  131.     {"Beans Can"},
  132.     {"Burger"},
  133.     {"Box of Matches"},
  134.     {"M1911 Mag"},
  135.     {"M1911"},
  136.     {"M9 SD"},
  137.     {"Desert Eagle Mag"},
  138.     {"Winchester 1866"},
  139.     {"PDW"},
  140.     {"Hunting Knife"},
  141.     {"Morphine"},
  142.     {"Hatchet"},
  143.     {"Pizza"},
  144.     {"Soda Bottle"},
  145.     {"Empty Gas Canister"},
  146.     {"Full Gas Canister"},
  147.     {"Roadflare"},
  148.     {"Milk"},
  149.     {"PDW Mag"},
  150.     {"MP5A5 Mag"},
  151.     {"AK Mag"},
  152.     {"M4 Mag"},
  153.     {"Tear Gas"},
  154.     {"Grenade"},
  155.     {"Desert Eagle"},
  156.     {"Sawn-Off Shotgun"},
  157.     {"SPAZ-12 Combat Shotgun"},
  158.     {"MP5A5"},
  159.     {"Watch"},
  160.     {"Medic Kit"},
  161.     {"Heat Pack"},
  162.     {"Lee Enfield"},
  163.     --{"TEC-9"},
  164.     {"AK-47"},
  165.     --{"M136 Rocket Launcher"},
  166.     {"Blood Bag"},
  167.     {"GPS"},
  168.     {"Map"},
  169.     {"Toolbox"},
  170.     {"Wire Fence"},
  171.     {"Tire"},
  172.     {"Engine"},
  173.     {"Tank Parts"},
  174.     --{"M136 Rocket"},
  175.     {"CZ 550 Mag"},
  176.     {"Lee Enfield Mag"},
  177.     {"M4"},
  178.     {"CZ 550"},
  179.     --{"Heat-Seeking RPG"},
  180.     {"Satchel"},
  181.     {"Infrared Goggles"},
  182.     {"Night Vision Goggles"},
  183.     {"Tent"},
  184.     {"Raw Meat"},
  185.     {"Cooked Meat"},
  186.     {"Camouflage Clothing"},
  187.     {"Ghillie Suit"},
  188.     {"Civilian Clothing"},
  189.     {"Survivor Clothing"},
  190.     {"Painkiller"},
  191.     {"Binoculars"},
  192.     {"Empty Water Bottle"},
  193.     {"Empty Soda Cans"},
  194.     {"Scruffy Burgers"},
  195.     {"1866 Slug"},
  196.     {"2Rnd. Slug"},
  197.     {"SPAZ-12 Pellet"},
  198.     {"Assault Pack (ACU)"},
  199.     {"Alice Pack"},
  200.     {"Radio Device"},
  201.     {"Coyote Backpack"},
  202.     {"Czech Backpack"},
  203.     {"Baseball Bat"},
  204.     {"Shovel"},
  205.     {"Golf Club"},
  206. }
  207.  
  208. function spawnDayZPlayer(player)
  209.     local number = math.random(table.size(spawnPositions))
  210.     local x, y, z = spawnPositions[number][1], spawnPositions[number][2], spawnPositions[number][3]
  211.    
  212.     spawnPlayer(player, x, y, z + 0.5, math.random(0, 360), 73, 0, 0)
  213.     fadeCamera(player, true)
  214.     setCameraTarget(player, player)
  215.     playerCol = createColSphere(x, y, z, 1.5)
  216.     setElementData(player, "playerCol", playerCol)
  217.     attachElements(playerCol, player, 0, 0, 0)
  218.     setElementData(playerCol, "parent", player)
  219.     setElementData(playerCol, "player", true)
  220.     local account = getPlayerAccount(player)
  221.     setAccountData(account, "isDead", false)
  222.     setElementData(player, "isDead", false)
  223.     setElementData(player, "logedin", true)
  224.     setElementData(player, "admin", getAccountData(account, "admin") or false)
  225.     setElementData(player, "supporter", getAccountData(account, "supporter") or false)
  226.    
  227.     ----------------------------------
  228.     --Player Items on Start
  229.     ----------------------------------
  230.     for i, data in ipairs(playerDataTable) do
  231.         if data[1] == "Bandage" then
  232.             setElementData(player, data[1], 2)
  233.         elseif data[1] == "Painkiller" then
  234.             setElementData(player, data[1], 1)
  235.         elseif data[1] == "MAX_Slots" then
  236.             setElementData(player, data[1], 8)
  237.         elseif data[1] == "skin" then
  238.             setElementData(player, data[1], 73)
  239.         elseif data[1] == "blood" then
  240.             setElementData(player, data[1], 12000)
  241.         elseif data[1] == "temperature" then
  242.             setElementData(player, data[1], 37)
  243.         elseif data[1] == "brokenbone" then
  244.             setElementData(player, data[1], false)
  245.         elseif data[1] == "pain" then
  246.             setElementData(player, data[1], false)
  247.         elseif data[1] == "cold" then
  248.             setElementData(player, data[1], false)
  249.         elseif data[1] == "infection" then
  250.             setElementData(player, data[1], false)
  251.         elseif data[1] == "food" then
  252.             setElementData(player, data[1], 100)
  253.         elseif data[1] == "thirst" then
  254.             setElementData(player, data[1], 100)
  255.         elseif data[1] == "currentweapon_1" then
  256.             setElementData(player, data[1], false)
  257.         elseif data[1] == "currentweapon_2" then
  258.             setElementData(player, data[1], false)
  259.         elseif data[1] == "currentweapon_3" then
  260.             setElementData(player, data[1], false)
  261.         elseif data[1] == "bandit" then
  262.             setElementData(player, data[1], false)
  263.         elseif data[1] == "humanity" then
  264.             setElementData(player, data[1], 2500)
  265.         else
  266.             setElementData(player, data[1], 0)
  267.         end
  268.     end
  269.     ----------------------------------
  270. end
  271.  
  272. --addEvent("onPlayerLoginToDayZ", true)
  273. --addEventHandler("onPlayerLoginToDayZ", getRootElement(), spawnDayZPlayer)
  274. --addEventHandler("onPlayerJoin", getRootElement(), spawnDayZPlayer)
  275.  
  276. function checkBuggedAccount()
  277.     for i, player in ipairs(getElementsByType("player")) do
  278.         local account = getPlayerAccount(player)
  279.        
  280.         if not account then return end
  281.        
  282.         if getElementData(player, "logedin") then
  283.             if getElementModel(player) == 0 then
  284.                 spawnDayZPlayer(player)
  285.                 outputChatBox(getPlayerName(player).."s Account is buggy and has been reset.", getRootElement(), 22, 255, 22, true)
  286.             end
  287.         end
  288.     end
  289. end
  290.  
  291. setTimer(checkBuggedAccount, 90000, 0)
  292.  
  293. function notifyAboutExplosion2()
  294.     for i, player in pairs(getVehicleOccupants(source)) do
  295.         triggerEvent("kilLDayZPlayer", player)
  296.     end
  297. end
  298.  
  299. addEventHandler("onVehicleExplode", getRootElement(), notifyAboutExplosion2)
  300.  
  301. function destroyDeadPlayer(ped, pedCol)
  302.     destroyElement(ped)
  303.     destroyElement(pedCol)
  304. end
  305.  
  306. function kilLDayZPlayer(killer, headshot, weapon)
  307.     pedCol = false
  308.     local account = getPlayerAccount(source)
  309.    
  310.     --if getElementData(source,"isInEvent") then removePlayerEvent(source) return end
  311.    
  312.     if not account then return end
  313.     killPed(source)
  314.     triggerClientEvent(source, "hideInventoryManual", source)
  315.    
  316.     if getElementData(source, "alivetime") > 10 then
  317.         if not isElementInWater(source) then
  318.             local x, y, z = getElementPosition(source)
  319.             if getDistanceBetweenPoints3D(x, y, z, 6000, 6000, 0) > 200 then
  320.                 local x, y, z = getElementPosition(source)
  321.                 local rotX, rotY, rotZ = getElementRotation(source)
  322.                 local skin = getElementModel(source)
  323.                 local ped = createPed(skin, x, y, z, rotZ)
  324.                
  325.                 pedCol = createColSphere(x, y, z, 1.5)
  326.                 killPed(ped)
  327.                 setTimer(destroyDeadPlayer, 3600000 * 0.75, 1, ped, pedCol)  
  328.                 attachElements(pedCol, ped, 0, 0, 0)
  329.                 setElementData(pedCol, "parent", ped)
  330.                 setElementData(pedCol, "playername", getPlayerName(source))
  331.                 setElementData(pedCol, "deadman", true)
  332.                 setElementData(pedCol, "MAX_Slots", getElementData(source, "MAX_Slots"))
  333.                
  334.                 local time = getRealTime()
  335.                 local hours = time.hour
  336.                 local minutes = time.minute
  337.                
  338.                 setElementData(pedCol, "deadreason", getPlayerName(source).." is dead. Cause of death: "..(weapon or "Unknown")..". Time of death: "..hours..":"..minutes.." o'clock.")
  339.             end
  340.         end
  341.     end
  342.    
  343.     if killer then
  344.         if not getElementData(source, "bandit") then
  345.             addPlayerStats(killer, "humanity", math.random(-2500, -1000))
  346.         else
  347.             addPlayerStats(killer, "humanity", math.random(1000, 2500))
  348.         end
  349.        
  350.         setElementData(killer, "murders", getElementData(killer, "murders") + 1)
  351.         setElementData(killer, "murders_total", getElementData(killer, "murders_total") + 1)
  352.        
  353.         if getElementData(killer, "humanity") < 0 then
  354.             setElementData(killer, "bandit", true)
  355.         end
  356.        
  357.         if getElementData(source, "bandit") == true then
  358.             setElementData(killer, "banditskilled", getElementData(killer, "banditskilled") + 1)
  359.         end
  360.        
  361.         if headshot == true then
  362.             setElementData(killer, "headshots", getElementData(killer, "headshots") + 1)
  363.         end
  364.        
  365.         triggerClientEvent("onRollMessageStart", getRootElement(), ""..getPlayerName(source).." was killed by a player "..getPlayerName(killer).." ("..(getElementData(killer, "weapon") or "fists")..")", 0, 22, 255, "died")
  366.     else
  367.         triggerClientEvent("onRollMessageStart", getRootElement(), ""..getPlayerName(source).." died ", 0, 22, 255, "died")
  368.     end
  369.    
  370.     --SetElementDatas
  371.     if pedCol then
  372.         for i, data in ipairs(playerDataTable) do
  373.             local plusData = getElementData(source, data[1])
  374.            
  375.             if data[1] == "M1911 Mag" then
  376.                 plusData = math.floor(getElementData(source, data[1]) / 7)
  377.             elseif data[1] == "M9 SD Mag" then
  378.                 plusData = math.floor(getElementData(source, data[1]) / 15)
  379.             elseif data[1] == "Desert Eagle Mag" then
  380.                 plusData = math.floor(getElementData(source, data[1]) / 7)
  381.             elseif data[1] == "PDW Mag" then
  382.                 plusData = math.floor(getElementData(source, data[1]) / 30)
  383.             elseif data[1] == "MP5A5 Mag" then
  384.                 plusData = math.floor(getElementData(source, data[1]) / 20)
  385.             elseif data[1] == "AK Mag" then
  386.                 plusData = math.floor(getElementData(source, data[1]) / 30)
  387.             elseif data[1] == "M4 Mag" then
  388.                 plusData = math.floor(getElementData(source, data[1]) / 20)
  389.             elseif data[1] == "CZ 550 Mag" then
  390.                 plusData = math.floor(getElementData(source, data[1]) / 5)
  391.             elseif data[1] == "Lee Enfield Mag" then
  392.                 plusData = math.floor(getElementData(source, data[1]) / 10)
  393.             elseif data[1] == "1866 Slug" then
  394.                 plusData = math.floor(getElementData(source, data[1]) / 7)
  395.             elseif data[1] == "SPAZ-12 Pellet" then
  396.                 plusData = math.floor(getElementData(source, data[1]) / 7)
  397.             elseif data[1] == "2Rnd. Slug" then
  398.                 plusData = math.floor(getElementData(source,d ata[1]) / 2)
  399.             end
  400.            
  401.             setElementData(pedCol, data[1], plusData)
  402.         end
  403.        
  404.         --Skin
  405.         local skinID = getElementData(source, "skin")
  406.         local skin = getSkinNameFromID(skinID)
  407.         setElementData(pedCol, skin, 1)
  408.        
  409.         --Backpack
  410.         local backpackSlots = getElementData(source, "MAX_Slots")
  411.         if backpackSlots == 12 then
  412.             setElementData(pedCol, "Assault Pack (ACU)", 1)
  413.         elseif backpackSlots == 16 then
  414.             setElementData(pedCol, "Alice Pack", 1)
  415.         elseif backpackSlots == 26 then
  416.             setElementData(pedCol, "Czech Backpack", 1)
  417.         elseif backpackSlots == 50 then
  418.             setElementData(pedCol, "Coyote Backpack", 1)
  419.         end
  420.     end
  421.    
  422.     setTimer(setElementPosition, 500, 1, source, 6000, 6000, 0)
  423.     triggerClientEvent(source, "onClientPlayerDeathInfo", source)
  424.     setAccountData(account, "isDead", true)
  425.     setElementData(source, "isDead", true)
  426.    
  427.     --triggerClientEvent ( "onRollMessageStart", getRootElement(),"Player #FFFFFF"..getPlayerName(source).." #FF0000was killed by a player "..getPlayerName(killer).." ("..(getElementData ( killer, "selectedWeapon") or "fists")..")",0,22,255, "died")
  428.    
  429.     destroyElement(getElementData(source, "playerCol"))
  430.     setTimer(spawnDayZPlayer, 5000, 1, source)
  431. end
  432.  
  433. addEvent("kilLDayZPlayer", true)
  434. addEventHandler("kilLDayZPlayer", getRootElement(), kilLDayZPlayer)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement