Advertisement
rockbandcheeseman

OnPlayerTeleport

Dec 5th, 2012
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.05 KB | None | 0 0
  1. -- Name
  2.  
  3. function GetRequiredVersion()
  4.  
  5.     return 10058
  6. end
  7.  
  8. function OnScriptLoad(process)
  9.  
  10.  
  11. end
  12.  
  13. function OnScriptUnload()
  14.  
  15.    
  16. end
  17.  
  18. function OnNewGame(map)
  19.  
  20.  
  21. end
  22.  
  23. function OnGameEnd(mode)
  24.  
  25.  
  26. end
  27.  
  28. function OnServerChat(player, chattype, message)
  29.  
  30.     return 1
  31. end
  32.  
  33. function OnServerCommand(player, command)
  34.  
  35.     return 1
  36. end
  37.  
  38. function OnTeamDecision(team)
  39.  
  40.     return team
  41. end
  42.  
  43. function OnPlayerJoin(player, team)
  44.  
  45.    
  46. end
  47.  
  48. function OnPlayerLeave(player, team)
  49.  
  50.  
  51. end
  52.  
  53. function OnPlayerKill(killer, victim, mode)
  54.  
  55.  
  56. end
  57.  
  58. function OnKillMultiplier(player, multiplier)
  59.  
  60.  
  61. end
  62.  
  63. function OnPlayerSpawn(player, m_objId)
  64.  
  65.  
  66. end
  67.  
  68. function OnPlayerSpawnEnd(player, m_objId)
  69.  
  70.    
  71. end
  72.  
  73. function OnTeamChange(relevant, player, cur_team, dest_team)
  74.  
  75.     return 1
  76. end
  77.  
  78. function OnObjectCreation(m_objId, player, tagName)
  79.  
  80.  
  81. end
  82.  
  83. function OnObjectInteraction(player, m_objId, tagType, tagName)
  84.    
  85.     return 1
  86. end
  87.  
  88. function OnWeaponAssignment(player, m_objId, slot, tagName)
  89.    
  90.     return 0
  91. end
  92.  
  93. function OnWeaponReload(player, m_weapId)
  94.  
  95.     return 1
  96. end
  97.  
  98. function OnDamageLookup(receiver, causer, tagData, tagName)
  99.  
  100.  
  101. end
  102.  
  103. function OnVehicleEntry(relevant, player, m_vehicleId, tagName, seat)
  104.  
  105.     return 1
  106. end
  107.  
  108. function OnVehicleEject(player, forced)
  109.  
  110.     return 1
  111. end
  112.  
  113. coords = {}
  114.  
  115. function OnClientUpdate(player, m_objId)
  116.  
  117.     local x, y, z = getobjectcoords(m_objId)
  118.     local hash = gethash(player)
  119.     local m_object = getobject(m_objId)
  120.     if m_object then
  121.         coords[hash] = coords[hash] or {}
  122.         local xdiff = (coords[hash][1] or x) - x
  123.         local ydiff = (coords[hash][2] or y) - y
  124.         local zdiff = (coords[hash][3] or z) - z
  125.         local dist = math.sqrt(xdiff ^ 2 + ydiff ^ 2 + zdiff ^ 2)
  126.         if dist > 1 then
  127.             OnPlayerTeleport(player, m_objId, x, y, z)
  128.         end
  129.     else
  130.         coords[hash] = {}
  131.     end
  132. end
  133.  
  134. -- Called when a player's coordinates change drastically within a small period of time; passes the player, m_objId and x, y, and z coordinates the player was teleported to.
  135. function OnPlayerTeleport(player, m_objId, x, y, z)
  136.  
  137.  
  138. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement