Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- PLUGIN = nil
- function Initialize(Plugin)
- Plugin:SetName("Sniper")
- Plugin:SetVersion(2)
- --Hooks
- cPluginManager:AddHook(cPluginManager.HOOK_PLAYER_USING_ITEM, using_item)
- cPluginManager:AddHook(cPluginManager.HOOK_PLAYER_ANIMATION, animation)
- cPluginManager:AddHook(cPluginManager.HOOK_PROJECTILE_HIT_ENTITY, OnProjectileHitEntity)
- PLUGIN = Plugin
- --Command Bindings
- cPluginManager.BindCommand("/sniper", "sniper.get", getsniper, " - /sniper - to get sniper")
- LOG("Initialised " .. Plugin:GetName() .. " v." .. Plugin:GetVersion())
- return true -- the trueth is out there
- end
- function OnDisable()
- LOG("Sniper shots itself...")
- end
- -- BEFHELAUSFÜRHUNG UND BEKOMMEN DER SNIPER-----------------------------------------
- function getsniper(Split, Player)
- local sniper = cItem(E_ITEM_DIAMOND_HORSE_ARMOR, 1, 0, "")
- --local sniper = cItem(ItemType, Count, Damage, EnchantmentString, CustomName, Lore)
- local sniper = cItem(E_ITEM_DIAMOND_HORSE_ARMOR, 1, 0, "", "§aSNIPER", "")
- Player:GetInventory():AddItem( sniper )
- return true
- end
- --RECHTKLICK UND DAMIT ANVISIEREN----------------------------------------------------------
- function using_item(Shooter, BlockX, BlockY, BlockZ, BlockFace, CursorX, CursorY, CursorZ, BlockType, BlockMeta)
- local sniper = cItem(E_ITEM_DIAMOND_HORSE_ARMOR, 1, 0, "", "§aSNIPER", "")
- local inhand = Shooter:GetEquippedItem()
- if ( sniper:IsEqual( inhand ) == true ) then
- if (not Shooter:HasEntityEffect( 2 ) ) then
- -- Does not have entity effect
- Shooter:SendMessageFatal("Look!")
- local Client = Shooter:GetClientHandle()
- --Client:SendSoundEffect("tile.piston.in", Shooter:GetPosX(), Shooter:GetPosY(), Shooter:GetPosZ(), 1.0, 63)
- Shooter:AddEntityEffect( 16, 90000, 1 ) -- night vision
- Shooter:AddEntityEffect( 2, 9000, 7 ) -- slowness
- --Player:AddEntit...
- else
- -- Has entity effect
- Shooter:RemoveEntityEffect( 16 )
- Shooter:RemoveEntityEffect( 2 )
- Shooter:SendMessageFatal("Stop to look!")
- end
- return false
- else
- return false
- end
- end
- --LINKSKLICK UND SCHIEßEN--------------------------------------------
- function left_click(Shooter)
- local sniper = cItem(E_ITEM_DIAMOND_HORSE_ARMOR, 1, 0, "", "§aSNIPER", "")
- local inhand = Shooter:GetEquippedItem()
- if ( sniper:IsEqual( inhand ) == true ) then
- local world = Shooter:GetWorld()
- --world:CreateProjectile(X, Y, Z, ProjectileKind, Creator, Originating Item, [Speed]) -- speed as vector!!!
- snowball = world:CreateProjectile(Shooter:GetPosX(), Shooter:GetPosY() + 1.5, Shooter:GetPosZ(), cProjectileEntity.pkSnowball, Shooter, Shooter:GetEquippedItem(), Shooter:GetLookVector() * 300)
- --[[ world:DoWithEntityById(snowball,
- function(a_Projectile)
- a_Projectile:SetGravity(0)
- end
- )]]
- local Client = Shooter:GetClientHandle()
- Client:SendSoundEffect("tile.piston.in", Shooter:GetPosX(), Shooter:GetPosY() , Shooter:GetPosZ(), 1.0, 63)
- return false
- end
- end
- -- LINKSKLICKVERWEIS--------------------------------------------------------------
- function animation(a_Player, a_Animation)
- -- In 1.8.x the left click has a value of 0, while in 1.7.x it\'s 1
- local LeftClickAnimation = (a_Player:GetClientHandle():GetProtocolVersion() > 5) and 0 or 1
- if (a_Animation ~= LeftClickAnimation) then
- return false
- end
- left_click(a_Player)
- end
- --PROJEKTILEINSCHLAG-------------------------------------------------------------
- function OnProjectileHitEntity(ProjectileEntity, Entity)
- ShooterName = ProjectileEntity:GetCreatorName()
- --Entity:TakeDamage(DamageType, AttackerEntity, RawDamage, KnockbackAmount)
- Entity:GetWorld():DoWithPlayer(ShooterName,
- function(a_Player)
- Entity:TakeDamage(dtArrow, a_Player, 18, 4)
- end
- )
- end
Advertisement
Add Comment
Please, Sign In to add comment