10-24-2012, 12:28 PM
Hey,
I want to make people unable to fly unless they have access to creative.
Now i created a piece of code for this.
But when i JUMP down it detects me as flying.
When i fall i don't have this problem.
Also when he does "hover". as i have to allow a range for jumping.
he can fly @ that height as long as he doesnt go up.
I want this to be fixed as well.
I use this piece of code
Is there a better way ?
This is the basic code later the player will be kicked when he tries to often.
Ofcourse when all is fixed.
I want to make people unable to fly unless they have access to creative.
Now i created a piece of code for this.
But when i JUMP down it detects me as flying.
When i fall i don't have this problem.
Also when he does "hover". as i have to allow a range for jumping.
he can fly @ that height as long as he doesnt go up.
I want this to be fixed as well.
I use this piece of code
function OnPlayerMove( Player ) local World = Player:GetWorld() local PlayerPos = Player:GetPosition() local Height = World:GetHeight( math.floor(PlayerPos.x), math.floor(PlayerPos.z) ) if( (Player:GetPosY()-4) > Height and Player:GetGameMode() == 0 ) then if (playerHeight[Player:GetName()] < Player:GetPosY()) then Player:SendMessage( "You'r not allowed to fly!." ) Player:TeleportTo( Player:GetPosX(), Height+1, Player:GetPosZ() ) end end playerHeight[Player:GetName()] = Player:GetPosY() end
Is there a better way ?
This is the basic code later the player will be kicked when he tries to often.
Ofcourse when all is fixed.