Advertisement
julib5432112345

Sniper

Jan 6th, 2016
316
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.29 KB | None | 0 0
  1. PLUGIN = nil
  2.  
  3. function Initialize(Plugin)
  4.  Plugin:SetName("Sniper")
  5.  Plugin:SetVersion(2)
  6.  
  7.   --Hooks
  8. cPluginManager:AddHook(cPluginManager.HOOK_PLAYER_USING_ITEM, RightClicking)
  9.  PLUGIN = Plugin
  10.   --Command Bindings
  11.  cPluginManager.BindCommand("/sniper", "sniper.get", getsniper, " - /sniper - to get sniper")
  12.  
  13.  LOG("Initialised " .. Plugin:GetName() .. " v." .. Plugin:GetVersion())
  14.  return true -- the trueth is out there
  15. end
  16.  
  17. function OnDisable()
  18.  LOG("Sniper shots itself...")
  19. end
  20.  
  21. function getsniper(Split, Player)
  22.  local sniper = cItem(E_ITEM_BLAZE_ROD, 1, 0, "")
  23.  --local sniper = cItem(ItemType, Count, Damage, EnchantmentString, CustomName, Lore)
  24.    local sniper = cItem(E_ITEM_BLAZE_ROD, 1, 0, "", "§aSNIPER", "")
  25.    Player:GetInventory():AddItem( sniper )
  26.    return true
  27. end
  28.  
  29. function RightClicking(Shooter, BlockX, BlockY, BlockZ, BlockFace, CursorX, CursorY, CursorZ, BlockType, BlockMeta)
  30.  local sniper = cItem(E_ITEM_BLAZE_ROD, 1, 0, "", "§aSNIPER", "")
  31.  local inhand = Shooter:GetEquippedItem()
  32.  if ( sniper:IsEqual( inhand ) == true ) then
  33.    Shooter:SendMessageFatal("Focus!")
  34.  
  35.    --Shooter:AddEntityEffect( 16, 1, 1 ) -- night vision
  36.    --Shooter:AddEntityEffect( 2 ) -- slowness
  37.      -- -> doesnt work at moment
  38.    return true
  39.  else
  40.    return false
  41.  end
  42. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement