Guest User

Untitled

a guest
Jan 10th, 2023
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.53 KB | None | 0 0
  1. // create some entity
  2. local hEntity = Entities.CreateByClassname("info_target");
  3. // create its script scope
  4. local tEntityScope = hEntity.GetOrCreatePrivateScriptScope();
  5. tEntityScope.MoveUp <- function (fUnits)
  6. {
  7.     // When this function executes, we're within the entity's script scope.
  8.     local vOrigin = self.GetOrigin();
  9.     vOrigin.y = vOrigin.y + fUnits;
  10.     self.SetOrigin(vOrigin);
  11. }
  12. // vOrigin no longer exists here, because it's local to the bracket above
  13. // However, tEntityScope still exists
  14. tEntityScope.MoveUp(10.0);
Advertisement
Add Comment
Please, Sign In to add comment