Cuberite Forum
Sniper / Gun - Printable Version

+- Cuberite Forum (https://forum.cuberite.org)
+-- Forum: Plugins (https://forum.cuberite.org/forum-1.html)
+--- Forum: Plugin Requests (https://forum.cuberite.org/forum-3.html)
+--- Thread: Sniper / Gun (/thread-2302.html)

Pages: 1 2 3


Sniper / Gun - JuliB - 01-06-2016

Hello.
I broke up with Java and fell in love with Cuberite.Heart I didn't found a gun plugin, and so I decided to request. Maybe it is a little bit like the paintball plugin by NiLSPACE.

With a command it should be possible to get the weapon. (Maybe a hors armor with a different name.) If the weapon is choosen and you click right, than it should simulate to aim at the cursor. While pressing the right of the mouse it should lay efffects on the player, like night vision and it should zoom.
Clicking left should shoot. Maybe a very fast snowball or anything like that. Is it possible to detect a head shot? (Would be nice) The person should receive damage (dead at head shot).Tongue

Hmmm Undecided It sounds a bit voilent...

Sry for my horrible english,

Juli


RE: Sniper / Gun - Schwertspize - 01-06-2016

Hmmm since the ctrl zoom is client side AFAIK, you can't let the client zoom in without modifying. Fast snowballs, arrows, etc are possible, effects too. If you want it cruel, even blood splashing should be possible (lava drops instead of blood splashing around)


RE: Sniper / Gun - NiLSPACE - 01-06-2016

It should be possible to do this. It's even pretty easy to detect if it's a headshot. Just detect if the height where the projectile hit is roughly the same height as the eyes of the player.


RE: Sniper / Gun - JuliB - 01-06-2016

Thx for the first answers!
First: I am peaceful -> no blood
I will write in short time when I have problems with writing the plugin myself...


RE: Sniper / Gun - JuliB - 01-07-2016

Okay...
I'm hanging... Given is the X, Y and Z-Position, but I don't know, how I can detect, if it hurts a player or an animal. Any ideas?


RE: Sniper / Gun - NiLSPACE - 01-07-2016

Can you show us your code?


RE: Sniper / Gun - JuliB - 01-07-2016

There is no function for shooting yet. In spite: http://pastebin.com/pvrp4sRm

Just the begin...


RE: Sniper / Gun - xoft - 01-07-2016

You need a cLineBlockTracer, that will tell you if a projectile hits an entity or a block. http://apidocs.cuberite.org/cLineBlockTracer.html


RE: Sniper / Gun - xoft - 01-07-2016

Oh wait, cLineBlockTracer doesn't report entities. My bad. You'll need to check manually.


RE: Sniper / Gun - NiLSPACE - 01-07-2016

No, you can just use the OnProjectileHitEntity hook: http://apidocs.cuberite.org/OnProjectileHitEntity.html
After that use cEntity:IsPlayer() to see if it was a player that was hit.