Nelsonnn

Untitled

Nov 5th, 2018
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 12.99 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.  
  209. function spawnDayZPlayer(player)
  210.     local number = math.random(table.size(spawnPositions))
  211.     local x,y,z = spawnPositions[number][1],spawnPositions[number][2],spawnPositions[number][3]
  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.     --Player Items on Start
  228.     for i,data in ipairs(playerDataTable) do
  229.         if data[1] =="Bandage" then
  230.             setElementData(player,data[1],2)    
  231.         elseif data[1] =="Painkiller" then
  232.             setElementData(player,data[1],1)        
  233.         elseif data[1] =="MAX_Slots" then
  234.             setElementData(player,data[1],8)    
  235.         elseif data[1] =="skin" then
  236.             setElementData(player,data[1],73)
  237.         elseif data[1] =="blood" then
  238.             setElementData(player,data[1],12000)
  239.         elseif data[1] =="temperature" then
  240.             setElementData(player,data[1],37)
  241.         elseif data[1] =="brokenbone" then
  242.             setElementData(player,data[1],false)    
  243.         elseif data[1] =="pain" then
  244.             setElementData(player,data[1],false)
  245.         elseif data[1] =="cold" then
  246.             setElementData(player,data[1],false)
  247.         elseif data[1] =="infection" then
  248.             setElementData(player,data[1],false)
  249.         elseif data[1] =="food" then
  250.             setElementData(player,data[1],100)
  251.         elseif data[1] =="thirst" then
  252.             setElementData(player,data[1],100)
  253.         elseif data[1] =="currentweapon_1" then
  254.             setElementData(player,data[1],false)
  255.         elseif data[1] =="currentweapon_2" then
  256.             setElementData(player,data[1],false)    
  257.         elseif data[1] =="currentweapon_3" then
  258.             setElementData(player,data[1],false)    
  259.         elseif data[1] =="bandit" then
  260.             setElementData(player,data[1],false)    
  261.         elseif data[1] =="humanity" then
  262.             setElementData(player,data[1],2500)
  263.         else
  264.             setElementData(player,data[1],0)
  265.         end    
  266.     end
  267.     ----------------------------------
  268. end
  269. --addEvent("onPlayerLoginToDayZ",true)
  270. --addEventHandler("onPlayerLoginToDayZ",getRootElement(),spawnDayZPlayer)
  271. --addEventHandler("onPlayerJoin",getRootElement(),spawnDayZPlayer)
  272.  
  273. function checkBuggedAccount()
  274.     for i,player in ipairs(getElementsByType("player")) do
  275.         local account = getPlayerAccount(player)
  276.         if not account then return end
  277.         if getElementData(player,"logedin") then
  278.             if getElementModel(player) == 0 then
  279.                 spawnDayZPlayer(player)
  280.                 outputChatBox(getPlayerName(player).."s Account is buggy and has been reset.",getRootElement(),22,255,22,true)
  281.             end
  282.         end
  283.     end
  284. end
  285. setTimer(checkBuggedAccount,90000,0)
  286.  
  287. function notifyAboutExplosion2()
  288.     for i,player in pairs(getVehicleOccupants(source)) do
  289.         triggerEvent("kilLDayZPlayer",player)
  290.     end
  291. end
  292. addEventHandler("onVehicleExplode", getRootElement(), notifyAboutExplosion2)
  293.  
  294. function destroyDeadPlayer (ped,pedCol)
  295.     destroyElement(ped)
  296.     destroyElement(pedCol)
  297. end
  298.  
  299. function kilLDayZPlayer (killer,headshot,weapon)
  300. pedCol = false
  301. local account = getPlayerAccount(source)
  302. --if getElementData(source,"isInEvent") then removePlayerEvent(source) return end
  303. if not account then return end
  304.     killPed(source)
  305.     triggerClientEvent(source,"hideInventoryManual",source)
  306.     if getElementData(source,"alivetime") > 10 then
  307.     if not isElementInWater(source) then
  308.     local x,y,z = getElementPosition(source)
  309.     if getDistanceBetweenPoints3D (x,y,z,6000,6000,0) > 200 then
  310.         local x,y,z = getElementPosition(source)
  311.         local rotX,rotY,rotZ = getElementRotation(source)
  312.         local skin = getElementModel(source)
  313.         local ped = createPed(skin,x,y,z,rotZ)
  314.         pedCol = createColSphere(x,y,z,1.5)
  315.         killPed(ped)
  316.         setTimer(destroyDeadPlayer,3600000*0.75,1,ped,pedCol)  
  317.         attachElements (pedCol,ped,0,0,0)
  318.         setElementData(pedCol,"parent",ped)
  319.         setElementData(pedCol,"playername",getPlayerName(source))
  320.         setElementData(pedCol,"deadman",true)
  321.         setElementData(pedCol,"MAX_Slots",getElementData(source,"MAX_Slots"))
  322.         local time = getRealTime()
  323.         local hours = time.hour
  324.         local minutes = time.minute
  325.         setElementData(pedCol,"deadreason",getPlayerName(source).." is dead. Cause of death: "..(weapon or "Unknown")..". Time of death: "..hours..":"..minutes.." o'clock.")
  326.     end
  327.     end
  328.     end
  329.         if killer then
  330.         if not getElementData(source,"bandit") then
  331.             addPlayerStats (killer,"humanity",math.random(-2500,-1000))
  332.         else
  333.             addPlayerStats (killer,"humanity",math.random(1000,2500))
  334.         end
  335.         setElementData(killer,"murders",getElementData(killer,"murders")+1)
  336.         if getElementData(killer,"humanity") < 0 then
  337.             setElementData(killer,"bandit",true)
  338.         end
  339.         if getElementData(source,"bandit") == true then
  340.             setElementData(killer,"banditskilled",getElementData(killer,"banditskilled")+1)
  341.         end
  342.         if headshot == true then
  343.             setElementData(killer,"headshots",getElementData(killer,"headshots")+1)
  344.        
  345.         end
  346.         triggerClientEvent ( "onRollMessageStart", getRootElement(),""..getPlayerName(source).." was killed by a player "..getPlayerName(killer).." ("..(getElementData ( killer, "weapon") or "fists")..")",0,22,255, "died")
  347. else
  348. triggerClientEvent ( "onRollMessageStart", getRootElement(),""..getPlayerName(source).." died ",0,22,255, "died")
  349.  
  350.         end
  351.         --SetElementDatas
  352.     if pedCol then
  353.         for i,data in ipairs(playerDataTable) do
  354.             local plusData = getElementData(source,data[1])
  355.             if data[1] == "M1911 Mag" then
  356.                 plusData = math.floor(getElementData(source,data[1])/7)
  357.             elseif data[1] == "M9 SD Mag" then
  358.                 plusData = math.floor(getElementData(source,data[1])/15)
  359.             elseif data[1] == "Desert Eagle Mag" then
  360.                 plusData = math.floor(getElementData(source,data[1])/7)
  361.             elseif data[1] == "PDW Mag" then
  362.                 plusData = math.floor(getElementData(source,data[1])/30)
  363.             elseif data[1] == "MP5A5 Mag" then
  364.                 plusData = math.floor(getElementData(source,data[1])/20)
  365.             elseif data[1] == "AK Mag" then
  366.                 plusData = math.floor(getElementData(source,data[1])/30)
  367.             elseif data[1] == "M4 Mag" then
  368.                 plusData = math.floor(getElementData(source,data[1])/20)
  369.             elseif data[1] == "CZ 550 Mag" then
  370.                 plusData = math.floor(getElementData(source,data[1])/5)
  371.             elseif data[1] == "Lee Enfield Mag" then
  372.                 plusData = math.floor(getElementData(source,data[1])/10)
  373.             elseif data[1] == "1866 Slug" then
  374.                 plusData = math.floor(getElementData(source,data[1])/7)
  375.             elseif data[1] == "SPAZ-12 Pellet" then
  376.                 plusData = math.floor(getElementData(source,data[1])/7)
  377.             elseif data[1] == "2Rnd. Slug" then
  378.                 plusData = math.floor(getElementData(source,data[1])/2)
  379.             end
  380.             setElementData(pedCol,data[1],plusData)
  381.         end
  382.         --Skin
  383.         local skinID = getElementData(source,"skin")
  384.         local skin = getSkinNameFromID(skinID)
  385.         setElementData(pedCol,skin,1)
  386.         --Backpack
  387.         local backpackSlots = getElementData(source,"MAX_Slots")
  388.         if backpackSlots == 12 then
  389.             setElementData(pedCol,"Assault Pack (ACU)",1)
  390.         elseif backpackSlots == 16 then
  391.             setElementData(pedCol,"Alice Pack",1)
  392.         elseif backpackSlots == 26 then
  393.             setElementData(pedCol,"Czech Backpack",1)
  394.         elseif backpackSlots == 50 then
  395.             setElementData(pedCol,"Coyote Backpack",1)
  396.         end
  397.     end
  398.         setTimer(setElementPosition,500,1,source,6000,6000,0)
  399.         triggerClientEvent(source,"onClientPlayerDeathInfo",source)
  400.         setAccountData(account,"isDead",true)
  401.         setElementData(source,"isDead",true)
  402.         --triggerClientEvent ( "onRollMessageStart", getRootElement(),"Player #FFFFFF"..getPlayerName(source).." #FF0000was killed by a player "..getPlayerName(killer).." ("..(getElementData ( killer, "selectedWeapon") or "fists")..")",0,22,255, "died")
  403.         destroyElement(getElementData(source,"playerCol"))
  404.         setTimer(spawnDayZPlayer,5000,1,source)
  405. end
  406. addEvent("kilLDayZPlayer",true)
  407. addEventHandler("kilLDayZPlayer",getRootElement(),kilLDayZPlayer)
Advertisement
Add Comment
Please, Sign In to add comment