Advertisement
Guest User

Untitled

a guest
Dec 22nd, 2014
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.00 KB | None | 0 0
  1. function spawnHandler ()
  2.     giveWeapon(source, 22, 1)
  3.     giveWeapon(source, 4, 1)
  4. end
  5.  
  6. addEventHandler("onPlayerSpawn", getRootElement(), spawnHandler)
  7.  
  8. function deadHandler (ammo, attacker, weapon, bodypart)
  9.     if (attacker == false) then
  10.         return
  11.     else
  12.         outputChatBox(tostring(getPlayerName(attacker)).." killed "..tostring(getPlayerName(source)).."!")
  13.     end
  14. end
  15.  
  16. addEventHandler ("onPlayerWasted", getRootElement(), deadHandler)
  17.  
  18. validValues =
  19. {
  20.     [4] = true,
  21.     [22] = true
  22. }
  23.  
  24. function oneHit (attacker, weapon)
  25.     if ( attacker == source ) then
  26.         return
  27.     else
  28.         if validValues[weapon] then
  29.             if (weapon == 4) then
  30.                 killPed (source)
  31.                 outputChatBox("Attacker: "..tostring(attacker))
  32.                 outputChatBox("Weapon Attacker: "..tostring(weapon))
  33.             elseif (weapon == 22) then
  34.                 killPed (source)
  35.                 outputChatBox("Attacker: "..tostring(attacker))
  36.                 outputChatBox("Weapon Attacker: "..tostring(weapon))
  37.             end
  38.         end
  39.     end
  40. end
  41.  
  42. addEventHandler ( "onPlayerDamage", getRootElement(), oneHit)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement