Facebook
From Niikelion, 8 Years ago, written in Lua.
This paste is a reply to lock player from Niikelion - view diff
Embed
Download Paste or View Raw
Hits: 440
  1. local nomove={}
  2. local succes
  3. function Initialize(Plugin)
  4.         Plugin:SetName("nomove")
  5.         Plugin:SetVersion(1)
  6.        
  7.        
  8.        
  9.         cPluginManager.BindCommand( "/lock" , "NT.lock" , LockPlayer , " - lock [player]" );
  10.         cPluginManager.BindCommand( "/unlock" , "NT.unlock" , UnlockPlayer , "- unlock [player]" );
  11.         cPluginManager.BindConsoleCommand("/lock",ConsoleLockPlayer," - lock [player]");
  12.         cPluginManager.BindConsoleCommand("/unlock",ConsoleUnlockPlayer," - unlock [player]");
  13.         cPluginManager.AddHook(cPluginManager.HOOK_PLAYER_MOVING,OnPlayerMoved)
  14.         return true
  15. end
  16.  
  17. function ConsoleLockPlayer(Split)
  18.         if #Split==2 then
  19.                 nomove[Split[1]]="locked"
  20.         end
  21.         return true
  22. end
  23.  
  24. function ConsoleUnlockPlayer(Split)
  25.         if #Split==2 then
  26.                 nomove[Split[1]]="unlocked"
  27.         end
  28.         return true
  29. end
  30.  
  31. function LockPlayer(Split,Player)
  32.         if #Split~=2 then
  33.                 Player:SendMessage("too few or too many arguments")
  34.         else
  35.                 nomove[Split[1]]="locked"
  36.         end
  37.         return true
  38. end
  39.  
  40. function UnlockPlayer(Split,Player,otherPlayer)
  41.         if #Split~=2 then
  42.                 Player:SendMessage("too few or too many arguments")
  43.         else
  44.                 nomove[Split[1]]="unlocked"
  45.         end
  46.         return true
  47. end
  48.  
  49. function OnPlayerMoved(Player)
  50.         if nomove[Player:GetName()]=="locked" then
  51.                 return true
  52.         end
  53. end