|
[SOLVED] a_Player:SetNormalMaxSpeed(0)
|
|
11-09-2015, 08:00 PM
That's because Minecraft changes the Field of View (FOV) depending on your speed attribute. Cuberite simply changes it and as a result Minecraft will also change the camera.If you don't want this you can try teleporting the player back once he leaves spot he's in.
Thanks given by: heroldini
ok, thanks...
then its no plugin bug, but rather a feature for now
11-10-2015, 06:25 AM
Pretty much the only thing I could think of in this situation without changing the FoV is using the OnPlayerMoving hook like so:
-- Lets have a table containing names of players that cannot move
StopMove = {}
-- Also, lets assume that their name was already inserted into the table somehow
function OnPlayerMoving(Player)
-- Search through the table as key-value format
for _, k in pairs(StopMoving) do
-- If the player's name happens to match a name in the table, stop them
if Player:GetName() == k then
-- Returning true means that the plugin has handled the player movement itself and the server doesn't have to perform any further actions
return true
end
end
end
Thanks given by: heroldini
11-11-2015, 01:01 AM
@DiamondToaster: You're using an inefficient way to do this. Reorganize your StopMove table to instead be a map of PlayerName -> true for all players that are to be stopped, then it's much better:
--- Map of PlayerName -> true for all players who should not be allowed to move
StopMove = {}
-- Stop a player from moving:
StopMove[a_Player:GetName()] = true
-- Enable player to move again:
StopMove[a_Player:GetName()] = nil
--- The hook handler for HOOK_PLAYER_MOVING, stops specified players from moving:
function OnPlayerMoving(Player)
if (StopMove[Player:GetName()]) then
return true
end
end
11-11-2015, 07:43 AM
Yeah. It's a bit of a bad habit treating them like C++ vectors. :/ Using a map and setting it to nil would definitely be better.
|
|
« Next Oldest | Next Newest »
|
Users browsing this thread: 1 Guest(s)

