Advertisement
Guest User

Untitled

a guest
Jun 11th, 2014
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 19.49 KB | None | 0 0
  1. myZombies = { }
  2. helmetzombies = { 27, 51, 52, 99, 27, 137, 153, 167, 205, 260, 277, 278, 279, 284, 285 }
  3. resourceRoot = getResourceRootElement()
  4.  
  5. --FORCES ZOMBIES TO MOVE ALONG AFTER THEIR TARGET PLAYER DIES
  6. function playerdead ()
  7. setTimer ( Zomb_release, 4000, 1 )
  8. end
  9. addEventHandler ( "onClientPlayerWasted", getLocalPlayer(), playerdead )
  10.  
  11. function Zomb_release ()
  12. for k, ped in pairs( myZombies ) do
  13. if (isElement(ped)) then
  14. if (getElementData (ped, "zombie") == true) then
  15. setElementData ( ped, "target", nil )
  16. setElementData ( ped, "status", "idle" )
  17. table.remove(myZombies,k)
  18. end
  19. end
  20. end
  21. end
  22.  
  23. --REMOVES A ZOMBIE FROM INFLUENCE AFTER ITS KILLED
  24. function pedkilled ( killer, weapon, bodypart )
  25. if (getElementData (source, "zombie") == true) and (getElementData (source, "status") ~= "dead" ) then
  26. setElementData ( source, "target", nil )
  27. setElementData ( source, "status", "dead" )
  28. end
  29. end
  30. addEventHandler ( "onClientPedWasted", getRootElement(), pedkilled )
  31.  
  32. --THIS CHECKS ALL ZOMBIES EVERY SECOND TO SEE IF THEY ARE IN SIGHT
  33. function zombie_check ()
  34. if (getElementData (getLocalPlayer (), "zombie") ~= true) and ( isPlayerDead ( getLocalPlayer () ) == false ) then
  35. local zombies = getElementsByType ( "ped",getRootElement(),true )
  36. local Px,Py,Pz = getElementPosition( getLocalPlayer () )
  37. if isPedDucked ( getLocalPlayer ()) then
  38. local Pz = Pz-1
  39. end
  40. for theKey,theZomb in ipairs(zombies) do
  41. if (isElement(theZomb)) then
  42. local Zx,Zy,Zz = getElementPosition( theZomb )
  43. if (getDistanceBetweenPoints3D(Px, Py, Pz, Zx, Zy, Zz) < 45 ) then
  44. if (getElementData (theZomb, "zombie") == true) then
  45. if ( getElementData ( theZomb, "status" ) == "idle" ) then --CHECKS IF AN IDLE ZOMBIE IS IN SIGHT
  46. local isclear = isLineOfSightClear (Px, Py, Pz+1, Zx, Zy, Zz +1, true, false, false, true, false, false, false)
  47. if (isclear == true) then
  48. setElementData ( theZomb, "status", "chasing" )
  49. setElementData ( theZomb, "target", getLocalPlayer() )
  50. table.insert( myZombies, theZomb ) --ADDS ZOMBIE TO PLAYERS COLLECTION
  51. table.remove( zombies, theKey)
  52. zombieradiusalert (theZomb)
  53. end
  54. elseif (getElementData(theZomb,"status") == "chasing") and (getElementData(theZomb,"target") == nil) then --CHECKS IF AN AGGRESSIVE LOST ZOMBIE IS IN SIGHT
  55. local isclear = isLineOfSightClear (Px, Py, Pz+1, Zx, Zy, Zz +1, true, false, false, true, false, false, false)
  56. if (isclear == true) then
  57. setElementData ( theZomb, "target", getLocalPlayer() )
  58. isthere = "no"
  59. for k, ped in pairs( myZombies ) do
  60. if ped == theZomb then
  61. isthere = "yes"
  62. end
  63. end
  64. if isthere == "no" then
  65. table.insert( myZombies, theZomb ) --ADDS THE WAYWARD ZOMBIE TO THE PLAYERS COLLECTION
  66. table.remove( zombies, theKey)
  67. end
  68. end
  69. elseif ( getElementData ( theZomb, "target" ) == getLocalPlayer() ) then --CHECKS IF AN ALREADY AGGRESSIVE ZOMBIE IS IN SIGHT
  70. local isclear = isLineOfSightClear (Px, Py, Pz+1, Zx, Zy, Zz +1, true, false, false, true, false, false, false)
  71. if (isclear == false) then --IF YOUR ZOMBIE LOST YOU, MAKES IT REMEMBER YOUR LAST COORDS
  72. setElementData ( theZomb, "target", nil )
  73. triggerServerEvent ("onZombieLostPlayer", theZomb, oldPx, oldPy, oldPz)
  74. end
  75. end
  76. end
  77. end
  78. end
  79. end
  80. --this second half is for checking peds and zombies
  81.  
  82. local nonzombies = getElementsByType ( "ped",getRootElement(),true )
  83. for theKey,theZomb in ipairs(zombies) do
  84. if (isElement(theZomb)) then
  85. if (getElementData (theZomb, "zombie") == true) then
  86. local Zx,Zy,Zz = getElementPosition( theZomb )
  87. for theKey,theNonZomb in ipairs(nonzombies) do
  88. if (getElementData (theNonZomb, "zombie") ~= true) then -- if the ped isnt a zombie
  89. local Px,Py,Pz = getElementPosition( theNonZomb )
  90. if (getDistanceBetweenPoints3D(Px, Py, Pz, Zx, Zy, Zz) < 45 ) then
  91. local isclear = isLineOfSightClear (Px, Py, Pz+1, Zx, Zy, Zz +1, true, false, false, true, false, false, false )
  92. if (isclear == true) and ( getElementHealth ( theNonZomb ) > 0) then
  93. if ( getElementData ( theZomb, "status" ) == "idle" ) then --CHECKS IF AN IDLE ZOMBIE IS IN SIGHT
  94. triggerServerEvent ("onZombieLostPlayer", theZomb, Px, Py, Pz)
  95. setElementData ( theZomb, "status", "chasing" )
  96. setElementData ( theZomb, "target", theNonZomb )
  97. zombieradiusalert (theZomb)
  98. elseif ( getElementData ( theZomb, "status" ) == "chasing" ) and ( getElementData ( theZomb, "target" ) == nil) then
  99. triggerServerEvent ("onZombieLostPlayer", theZomb, Px, Py, Pz)
  100. setElementData ( theZomb, "target", theNonZomb )
  101. end
  102. end
  103. end
  104. if ( getElementData ( theZomb, "target" ) == theNonZomb ) then --CHECKS IF AN ALREADY AGGRESSIVE ZOMBIE IS IN SIGHT OF THE PED
  105. local Px,Py,Pz = getElementPosition( theNonZomb )
  106. if (getDistanceBetweenPoints3D(Px, Py, Pz, Zx, Zy, Zz) < 45 ) then
  107. local isclear = isLineOfSightClear (Px, Py, Pz+1, Zx, Zy, Zz+1, true, false, false, true, false, false, false)
  108. if (isclear == false) then --IF YOUR ZOMBIE LOST THE PED, MAKES IT REMEMBER the peds LAST COORDS
  109. triggerServerEvent ("onZombieLostPlayer", theZomb, Px, Py, Pz)
  110. setElementData ( theZomb, "target", nil )
  111. end
  112. end
  113. end
  114. end
  115. end
  116. end
  117. end
  118. end
  119. end
  120. for k, ped in pairs( myZombies ) do
  121. if (isElement(ped) == false) then
  122. table.remove( myZombies, k)
  123. end
  124. end
  125. oldPx,oldPy,oldPz = getElementPosition( getLocalPlayer () )
  126. end
  127.  
  128.  
  129. --INITAL SETUP
  130.  
  131. function clientsetupstarter(startedresource)
  132. if startedresource == getThisResource() then
  133. setTimer ( clientsetup, 1234, 1)
  134. MainClientTimer1 = setTimer ( zombie_check, 1000, 0) --STARTS THE TIMER TO CHECK FOR ZOMBIES
  135. end
  136. end
  137. addEventHandler("onClientResourceStart", getRootElement(), clientsetupstarter)
  138.  
  139. function clientsetup()
  140. oldPx,oldPy,oldPz = getElementPosition( getLocalPlayer () )
  141. throatcol = createColSphere ( 0, 0, 0, .3)
  142. woodpic = guiCreateStaticImage( .65, .06, .1, .12, "zombiewood.png", true )
  143. guiSetVisible ( woodpic, false )
  144.  
  145. --ALL ZOMBIES STFU
  146. local zombies = getElementsByType ( "ped" )
  147. for theKey,theZomb in ipairs(zombies) do
  148. if (isElement(theZomb)) then
  149. if (getElementData (theZomb, "zombie") == true) then
  150. setPedVoice(theZomb, "PED_TYPE_DISABLED")
  151. end
  152. end
  153. end
  154.  
  155. --SKIN REPLACEMENTS
  156. local skin = engineLoadTXD ( "skins/13.txd" ) --bleedin eyes 31 by Slothman
  157. engineImportTXD ( skin, 13 )
  158. local skin = engineLoadTXD ( "skins/22.txd" ) -- slashed 12 by Wall-E
  159. engineImportTXD ( skin, 22 )
  160. local skin = engineLoadTXD ( "skins/56.txd" ) --young and blue by Slothman
  161. engineImportTXD ( skin, 56 )
  162. local skin = engineLoadTXD ( "skins/67.txd" ) -- slit r* employee
  163. engineImportTXD ( skin, 67 )
  164. local skin = engineLoadTXD ( "skins/68.txd" ) -- shredded preist by Deixell
  165. engineImportTXD ( skin, 68 )
  166. local skin = engineLoadTXD ( "skins/69.txd" ) --bleedin eyes in denim by Capitanazop
  167. engineImportTXD ( skin, 69 )
  168. local skin = engineLoadTXD ( "skins/70.txd" ) --ultra gory scientist by 50p
  169. engineImportTXD ( skin, 70 )
  170. local skin = engineLoadTXD ( "skins/84.txd" ) --guitar wolf (nonzombie) by Slothman
  171. engineImportTXD ( skin, 84 )
  172. local skin = engineLoadTXD ( "skins/92.txd" ) -- peeled flesh by xbost
  173. engineImportTXD ( skin, 92 )
  174. local skin = engineLoadTXD ( "skins/97.txd" ) -- easterboy by Slothman
  175. engineImportTXD ( skin, 97 )
  176. local skin = engineLoadTXD ( "skins/105.txd" ) --Scarred Grove Gangster by Wall-E
  177. engineImportTXD ( skin, 105 )
  178. local skin = engineLoadTXD ( "skins/107.txd" ) --ripped and slashed grove by Wall-E
  179. engineImportTXD ( skin, 107 )
  180. local skin = engineLoadTXD ( "skins/108.txd" ) -- skeleton thug by Deixell
  181. engineImportTXD ( skin, 108 )
  182. local skin = engineLoadTXD ( "skins/111.txd" ) --Frank West from dead rising (nonzombie) by Slothman
  183. engineImportTXD ( skin, 111 )
  184. local skin = engineLoadTXD ( "skins/126.txd" ) -- bullet ridden wiseguy by Slothman
  185. engineImportTXD ( skin, 126 )
  186. local skin = engineLoadTXD ( "skins/127.txd" ) --flyboy from dawn of the dead by Slothman
  187. engineImportTXD ( skin, 127 )
  188. local skin = engineLoadTXD ( "skins/128.txd" ) --holy native by Slothman
  189. engineImportTXD ( skin, 128 )
  190. local skin = engineLoadTXD ( "skins/152.txd" ) --bitten schoolgirl by Slothman
  191. engineImportTXD ( skin, 152 )
  192. local skin = engineLoadTXD ( "skins/162.txd" ) --shirtless redneck by Slothman
  193. engineImportTXD ( skin, 162 )
  194. local skin = engineLoadTXD ( "skins/167.txd" ) --dead chickenman by 50p
  195. engineImportTXD ( skin, 167 )
  196. local skin = engineLoadTXD ( "skins/188.txd" ) --burnt greenshirt by Slothman
  197. engineImportTXD ( skin, 188 )
  198. local skin = engineLoadTXD ( "skins/192.txd" ) --Alice from resident evil (nonzombie) by Slothman
  199. engineImportTXD ( skin, 192 )
  200. local skin = engineLoadTXD ( "skins/195.txd" ) --bloody ex by Slothman
  201. engineImportTXD ( skin, 195 )
  202. local skin = engineLoadTXD ( "skins/206.txd" ) -- faceless zombie by Slothman
  203. engineImportTXD ( skin, 206 )
  204. local skin = engineLoadTXD ( "skins/209.txd" ) --Noodle vendor by 50p
  205. engineImportTXD ( skin, 209 )
  206. local skin = engineLoadTXD ( "skins/212.txd" ) --brainy hobo by Slothman
  207. engineImportTXD ( skin, 212 )
  208. local skin = engineLoadTXD ( "skins/229.txd" ) --infected tourist by Slothman
  209. engineImportTXD ( skin, 229 )
  210. local skin = engineLoadTXD ( "skins/230.txd" ) --will work for brains hobo by Slothman
  211. engineImportTXD ( skin, 230 )
  212. local skin = engineLoadTXD ( "skins/258.txd" ) --bloody sided suburbanite by Slothman
  213. engineImportTXD ( skin, 258 )
  214. local skin = engineLoadTXD ( "skins/264.txd" ) --scary clown by 50p
  215. engineImportTXD ( skin, 264 )
  216. local skin = engineLoadTXD ( "skins/274.txd" ) --Ash Williams (nonzombie) by Slothman
  217. engineImportTXD ( skin, 274 )
  218. local skin = engineLoadTXD ( "skins/277.txd" ) -- gutted firefighter by Wall-E
  219. engineImportTXD ( skin, 277 )
  220. local skin = engineLoadTXD ( "skins/280.txd" ) --infected cop by Lordy
  221. engineImportTXD ( skin, 280 )
  222. local skin = engineLoadTXD ( "skins/287.txd" ) --torn army by Deixell
  223. engineImportTXD ( skin, 287 )
  224. end
  225.  
  226. --UPDATES PLAYERS COUNT OF AGGRESIVE ZOMBIES
  227. addEventHandler ( "onClientElementDataChange", getRootElement(),
  228. function ( dataName )
  229. if getElementType ( source ) == "ped" and dataName == "status" then
  230. local thestatus = (getElementData ( source, "status" ))
  231. if (thestatus == "idle") or (thestatus == "dead") then
  232. for k, ped in pairs( myZombies ) do
  233. if ped == source and (getElementData (ped, "zombie") == true) then
  234. setElementData ( ped, "target", nil )
  235. table.remove( myZombies, k)
  236. setElementData ( getLocalPlayer(), "dangercount", tonumber(table.getn( myZombies )) )
  237. end
  238. end
  239. end
  240. end
  241. end )
  242.  
  243. --MAKES A ZOMBIE JUMP
  244. addEvent( "Zomb_Jump", true )
  245. function Zjump ( ped )
  246. if (isElement(ped)) then
  247. setPedControlState( ped, "jump", true )
  248. setTimer ( function (ped) if ( isElement ( ped ) ) then setPedControlState ( ped, "jump", false) end end, 800, 1, ped )
  249. end
  250. end
  251. addEventHandler( "Zomb_Jump", getRootElement(), Zjump )
  252.  
  253. --MAKES A ZOMBIE PUNCH
  254. addEvent( "Zomb_Punch", true )
  255. function Zpunch ( ped )
  256. if (isElement(ped)) then
  257. setPedControlState( ped, "fire", true )
  258. setTimer ( function (ped) if ( isElement ( ped ) ) then setPedControlState ( ped, "fire", false) end end, 800, 1, ped )
  259. end
  260. end
  261. addEventHandler( "Zomb_Punch", getRootElement(), Zpunch )
  262.  
  263. --MAKES A ZOMBIE STFU
  264. addEvent( "Zomb_STFU", true )
  265. function Zstfu ( ped )
  266. if (isElement(ped)) then
  267. setPedVoice(ped, "PED_TYPE_DISABLED")
  268. end
  269. end
  270. addEventHandler( "Zomb_STFU", getRootElement(), Zstfu )
  271.  
  272. --MAKES A ZOMBIE MOAN
  273. addEvent( "Zomb_Moan", true )
  274. function Zmoan ( ped, randnum )
  275. if (isElement(ped)) then
  276. local Zx,Zy,Zz = getElementPosition( ped )
  277. local sound = playSound3D("sounds/mgroan"..randnum..".ogg", Zx, Zy, Zz, false)
  278. setSoundMaxDistance(sound, 20)
  279. end
  280. end
  281. addEventHandler( "Zomb_Moan", getRootElement(), Zmoan )
  282.  
  283. --ZOMBIE HEADSHOTS TO ALL BUT HELMETED ZOMBIES
  284. function zombiedamaged ( attacker, weapon, bodypart )
  285. if getElementType ( source ) == "ped" then
  286. if (getElementData (source, "zombie") == true) then
  287. if ( bodypart == 9 ) then
  288. helmeted = "no"
  289. local zskin = getElementModel ( source )
  290. for k, skin in pairs( helmetzombies ) do
  291. if skin == zskin then
  292. helmeted = "yes"
  293. end
  294. end
  295. if helmeted == "no" then
  296. triggerServerEvent ("headboom", source, source, attacker, weapon, bodypart )
  297. end
  298. end
  299. end
  300. end
  301. end
  302. addEventHandler ( "onClientPedDamage", getRootElement(), zombiedamaged )
  303.  
  304. function zombiedkilled(killer, weapon, bodypart)
  305. if getElementType ( source ) == "ped" then
  306. if (getElementData (source, "zombie") == true) then
  307. setElementCollisionsEnabled(source, false)
  308. end
  309. end
  310. end
  311. addEventHandler ( "onClientPedWasted", getRootElement(), zombiedkilled )
  312.  
  313. --CAUSES MORE DAMAGE TO PLAYER WHEN ATTACKED BY A ZOMBIE
  314. function zombieattack ( attacker, weapon, bodypart )
  315. if (attacker) then
  316. if getElementType ( attacker ) == "ped" then
  317. if (getElementData (attacker, "zombie") == true) then
  318. local playerHealth = getElementHealth ( getLocalPlayer() )
  319. if playerHealth > 15 then
  320. setElementHealth ( source, playerHealth - 15 )
  321. else
  322. triggerServerEvent ("playereaten", source, source, attacker, weapon, bodypart )
  323. end
  324. end
  325. end
  326. end
  327. end
  328. addEventHandler ( "onClientPlayerDamage", getLocalPlayer(), zombieattack )
  329.  
  330. --WOOD GUI
  331. function showwoodpic ( theElement, matchingDimension )
  332. if ( theElement == getLocalPlayer() ) and (getElementData ( source, "purpose" ) == "zombiewood" ) then
  333. guiSetVisible ( woodpic, true )
  334. end
  335. end
  336. addEventHandler ( "onClientColShapeHit", getRootElement(), showwoodpic )
  337.  
  338. function hidewoodpic ( theElement, matchingDimension )
  339. if ( theElement == getLocalPlayer() ) and (getElementData ( source, "purpose" ) == "zombiewood" ) then
  340. guiSetVisible ( woodpic, false )
  341. end
  342. end
  343. addEventHandler ( "onClientColShapeLeave", getRootElement(), hidewoodpic )
  344.  
  345. --ZOMBIES ATTACK FROM BEHIND AND GUI STUFF
  346. function movethroatcol ()
  347. local screenWidth, screenHeight = guiGetScreenSize()
  348. local dcount = tostring(table.getn( myZombies ))
  349. dxDrawText( dcount, screenWidth-40, screenHeight -50, screenWidth, screenHeight, tocolor ( 0, 0, 0, 255 ), 1.44, "pricedown" )
  350. dxDrawText( dcount, screenWidth-42, screenHeight -52, screenWidth, screenHeight, tocolor ( 255, 255, 255, 255 ), 1.4, "pricedown" )
  351.  
  352. if isElement(throatcol) then
  353. local playerrot = getPedRotation ( getLocalPlayer () )
  354. local radRot = math.rad ( playerrot )
  355. local radius = 1
  356. local px,py,pz = getElementPosition( getLocalPlayer () )
  357. local tx = px + radius * math.sin(radRot)
  358. local ty = py + -(radius) * math.cos(radRot)
  359. local tz = pz
  360. setElementPosition ( throatcol, tx, ty, tz )
  361. end
  362. end
  363. addEventHandler ( "onClientRender", getRootElement(), movethroatcol )
  364.  
  365. function choketheplayer ( theElement, matchingDimension )
  366. if getElementType ( theElement ) == "ped" and ( isPlayerDead ( getLocalPlayer () ) == false ) then
  367. if ( getElementData ( theElement, "target" ) == getLocalPlayer () ) and (getElementData (theElement, "zombie") == true) then
  368. local px,py,pz = getElementPosition( getLocalPlayer () )
  369. setTimer ( checkplayermoved, 600, 1, theElement, px, py, pz)
  370. end
  371. end
  372. end
  373. addEventHandler ( "onClientColShapeHit", getRootElement(), choketheplayer )
  374.  
  375. function checkplayermoved (zomb, px, py, pz)
  376. if (isElement(zomb)) then
  377. local nx,ny,nz = getElementPosition( getLocalPlayer () )
  378. local distance = (getDistanceBetweenPoints3D (px, py, pz, nx, ny, nz))
  379. if (distance < .7) and ( isPlayerDead ( getLocalPlayer () ) == false ) then
  380. setElementData ( zomb, "status", "throatslashing" )
  381. end
  382. end
  383. end
  384.  
  385. --ALERTS ANY IDLE ZOMBIES WITHIN A RADIUS OF 10 WHEN GUNSHOTS OCCUR OR OTHER ZOMBIES GET ALERTED
  386. function zombieradiusalert (theElement)
  387. local Px,Py,Pz = getElementPosition( theElement )
  388. local zombies = getElementsByType ( "ped" )
  389. for theKey,theZomb in ipairs(zombies) do
  390. if (isElement(theZomb)) then
  391. if (getElementData (theZomb, "zombie") == true) then
  392. if ( getElementData ( theZomb, "status" ) == "idle" ) then
  393. local Zx,Zy,Zz = getElementPosition( theZomb )
  394. local distance = (getDistanceBetweenPoints3D (Px, Py, Pz, Zx, Zy, Zz))
  395. if (distance < 10) and ( isPlayerDead ( getLocalPlayer () ) == false ) then
  396. isthere = "no"
  397. for k, ped in pairs( myZombies ) do
  398. if ped == theZomb then
  399. isthere = "yes"
  400. end
  401. end
  402. if isthere == "no" and (getElementData (getLocalPlayer (), "zombie") ~= true) then
  403. if (getElementType ( theElement ) == "ped") then
  404. local isclear = isLineOfSightClear (Px, Py, Pz, Zx, Zy, Zz, true, false, false, true, false, false, false)
  405. if (isclear == true) then
  406. setElementData ( theZomb, "status", "chasing" )
  407. setElementData ( theZomb, "target", getLocalPlayer () )
  408. table.insert( myZombies, theZomb ) --ADDS ZOMBIE TO PLAYERS COLLECTION
  409. end
  410. else
  411. setElementData ( theZomb, "status", "chasing" )
  412. setElementData ( theZomb, "target", getLocalPlayer () )
  413. table.insert( myZombies, theZomb ) --ADDS ZOMBIE TO PLAYERS COLLECTION
  414. end
  415. end
  416. end
  417. end
  418. end
  419. end
  420. end
  421. end
  422.  
  423. function shootingnoise ( weapon, ammo, ammoInClip, hitX, hitY, hitZ, hitElement)
  424. if alertspacer ~= 1 then
  425. if (weapon == 9) then
  426. alertspacer = 1
  427. setTimer ( resetalertspacer, 5000, 1 )
  428. zombieradiusalert(getLocalPlayer ())
  429. elseif (weapon > 21) and (weapon ~= 23) then
  430. alertspacer = 1
  431. setTimer ( resetalertspacer, 5000, 1 )
  432. zombieradiusalert(getLocalPlayer ())
  433. end
  434. end
  435. if hitElement then
  436. if (getElementType ( hitElement ) == "ped") then
  437. if (getElementData (hitElement, "zombie") == true) then
  438. isthere = "no"
  439. for k, ped in pairs( myZombies ) do
  440. if ped == hitElement then
  441. isthere = "yes"
  442. end
  443. end
  444. if isthere == "no" and (getElementData (getLocalPlayer (), "zombie") ~= true) then
  445. setElementData ( hitElement, "status", "chasing" )
  446. setElementData ( hitElement, "target", getLocalPlayer () )
  447. table.insert( myZombies, hitElement ) --ADDS ZOMBIE TO PLAYERS COLLECTION
  448. zombieradiusalert (hitElement)
  449. end
  450. end
  451. end
  452. end
  453. end
  454. addEventHandler ( "onClientPlayerWeaponFire", getLocalPlayer (), shootingnoise )
  455.  
  456. function resetalertspacer ()
  457. alertspacer = nil
  458. end
  459.  
  460. function choketheplayer ( theElement, matchingDimension )
  461. if getElementType ( theElement ) == "ped" and ( isPlayerDead ( getLocalPlayer () ) == false ) and (getElementData (theElement , "zombie") == true) then
  462. if ( getElementData ( theElement, "target" ) == getLocalPlayer () ) then
  463. local px,py,pz = getElementPosition( getLocalPlayer () )
  464. setTimer ( checkplayermoved, 600, 1, theElement, px, py, pz)
  465. end
  466. end
  467. end
  468.  
  469. addEvent( "Spawn_Placement", true )
  470. function Spawn_Place(xcoord, ycoord)
  471. local x,y,z = getElementPosition( getLocalPlayer() )
  472. local posx = x+xcoord
  473. local posy = y+ycoord
  474. local gz = getGroundPosition ( posx, posy, z+500 )
  475. triggerServerEvent ("onZombieSpawn", getLocalPlayer(), posx, posy, gz+1 )
  476. end
  477. addEventHandler("Spawn_Placement", getRootElement(), Spawn_Place)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement