Simple doublejump - Printable Version +- Cuberite Forum (https://forum.cuberite.org) +-- Forum: Plugins (https://forum.cuberite.org/forum-1.html) +--- Forum: Plugin Discussion (https://forum.cuberite.org/forum-8.html) +--- Thread: Simple doublejump (/thread-2953.html) |
Simple doublejump - nrgjrteherh435 - 05-19-2017 So I'm coding a doublejump plugin for my server, and I was wondering what the most optimal way of doing so was. My current code: Code: function OnTick(Player, TimeDelta) I haven't really dug into the docs yet, so I'm likely missing something. I know that I would need to track the jump input in the if statement somehow... How would I go about doing that? Also, does IsSprinting get set to false if the player is airborne? And is it smart to be checking this every tick, or is there another hook that would be more optimal? Please and thank you. RE: Simple doublejump - xoft - 05-19-2017 I'm afraid any kind of a doublejump plugin would be a hack at best. Currently, there's no way for Cuberite plugins to read the packets sent by the client directly, so there's no way to detect the second press of the jump key (even if the client send it at all (?)). The IsSprinting flag is taken directly from the client, so whatever the client says, the flag mirrors. As for your code, the OnTick() hook doesn't get any Player parameter, it gets a World parameter, so you'll need to iterate over all players in the world. Also note that most if not all functions in Cuberite API need to be called using the colon convention - Player:IsOnGround() etc. RE: Simple doublejump - NiLSPACE - 05-19-2017 I've seen people implement double jumping by detecting if they're flying. It would end up something like this: Code: if (player is flying) then RE: Simple doublejump - Seadragon91 - 05-19-2017 Another idea would be to use AddEntityEffect_1: a_Player:AddEntityEffect(cEntityEffect.effJumpBoost, 200, 1, 1) This gives you jump boost 2 with an duration of 10s RE: Simple doublejump - NiLSPACE - 05-19-2017 That isn't a double jump though. It might be sufficient depending on what @nrgjrteherh435 wants to have double jump for. |