Guest User

Untitled

a guest
Jun 25th, 2018
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 5.60 KB | None | 0 0
  1. -- This function is required for scripts to run on Phasor (including and after 01.00.03.104)
  2. -- You should return the minimum required version of Phasor
  3. -- Official releases:
  4. --   01.00.03.104 - 3104
  5. --   01.00.10.057 - 10057
  6. function GetRequiredVersion()
  7. say ("1")
  8.     return 10057
  9. end
  10.  
  11. -- called when the script is loaded
  12. function OnScriptLoad(process)
  13. end
  14.  
  15. -- called when the script is unloaded
  16. -- Do not return a value
  17. function OnScriptUnload()
  18. end
  19.  
  20. -- called when a game is starting (before any players join)
  21. -- Do not return a value.
  22. function OnNewGame(map)
  23. end
  24.  
  25. -- called when a game is ending
  26. -- Do not return a value.
  27. function OnGameEnd(mode)
  28.     -- mode 1 = score menu (F1) is being displayed to clients, they are still ingame
  29.     -- mode 2 = post game menu appeared
  30.     -- mode 3 = players can quit via the post game score card
  31. end
  32.  
  33. -- Called when there is chat within the server
  34. -- It must return a value which indicates whether or not the chat is sent.
  35. function OnServerChat(player, chattype, message)
  36.     return 1
  37. end
  38.  
  39. -- Called when a server command is being executed
  40. -- It must return a value which indicates whether or not the command should be processed
  41. -- Note: It is only called when an authenticated (and allowed) player attempts to use the command.
  42. --       player is -1 when being executed via the server console.
  43. function OnServerCommand(player, command)
  44.     return 1
  45. end
  46.  
  47. -- Called when a player's team is being chosen as the join the server.
  48. -- It must return a value which indicates the team the player is to be put on.
  49. -- Note: this function being called doesn't guarantee that the player will be able to successfully join.
  50. function OnTeamDecision(cur_team)
  51.     return dest_team
  52. end
  53.  
  54. -- Called when a player joins the server.
  55. -- Do not return a value.
  56. function OnPlayerJoin(player, team)
  57. end
  58.  
  59. -- Called when a player the server.
  60. -- Do not return a value.
  61. function OnPlayerLeave(player, team)
  62. end
  63.  
  64. -- called when a player kills another, 'killer' is the index of the killing player, 'victim' is the index of the dead player
  65. -- Do not return a value.
  66. function OnPlayerKill(killer, victim, mode)
  67. end
  68.  
  69. -- called when a player gets a double kill, killing spree etc
  70. -- see Phasor documentation for multiplier values
  71. function OnKillMultiplier(player, multiplier)
  72. end
  73.  
  74. -- Called when a player s (after object is created, before players are notified)
  75. -- Do not return a value
  76. function OnPlayerSpawn(player, m_objectId)
  77. end
  78.  
  79. -- Called after clients have been notified of a player spawn
  80. -- Do not return a value
  81. function OnPlayerSpawnEnd(player, m_objectId)
  82.  
  83. end
  84.  
  85. -- Called when a player is attempting to .
  86. -- A value must be returned. The return value indicates whether or not the player is allowed the change team.
  87. -- Notes: If relevant is 1 the return value is considered, if it's 0 then the return value is ignored.
  88. function OnTeamChange(relevant, player, team, dest_team)
  89.     return 1
  90. end
  91.  
  92. -- This is called when a client sends the server an update packet.
  93. -- This includes things such as movement vectors, camera positions, button presses etc.
  94. -- This function is called frequently so care should be taken to keep processing
  95. -- to a minimum.
  96. -- Do not return a value
  97. function OnClientUpdate(player, m_objectId)
  98.  
  99. if object_in_sphere( X, Y, Z, R, m_objectId) == true then -- I didn't put coords in yet.
  100.         registertimer(5000, timer)
  101.         kill(player)
  102.         privatesay(privatesay, "You have 5 seconds to stop Blocking.")
  103. end
  104. end
  105.  
  106. -- Called when a player interacts with an object
  107. -- It can be called while attempting to pick the object up
  108. -- It is also called when standing above an object so can be called various times quickly
  109. function OnObjectInteraction(player, m_ObjectId, tagType, tagName)
  110.     return 1
  111. end
  112.  
  113. -- Called when a player attempts to reload their weapon.
  114. -- A value must be returned. The return value indicates whether or not the player is allowed to reload.
  115. -- Notes: If player is -1 then the weapon being reload wasn't located (it could be a vehicle's weapon)
  116. function OnWeaponReload(player, weapon)
  117.     return 1
  118. end
  119.  
  120. -- Called when a player attempts to enter a vehicle.
  121. --The return value indicates whether or not the player is allowed to enter.
  122. function OnVehicleEntry(relevant, player, vehicleId, vehicle_tag, seat)
  123.     return 1
  124. end
  125.  
  126. -- Called when a player is being ejected from their vehicle
  127. -- Return 1 or 0 to allow/block it.
  128. function OnVehicleEject(player, forceEject)
  129.     return 1
  130. end
  131.  
  132.  
  133. -- Called when damage is being done to an object.
  134. -- This doesn't always need to be a player.
  135. -- Do not return a value
  136. function OnDamageLookup(receiving_obj, causing_obj, tagdata, tagname)
  137. end
  138.  
  139. -- Called when a player is being assigned a weapon (usually when they spawn)
  140. -- A value must be returned. The return value is the id of the weapon they're to spawn with. Return zero if the weapon shouldn't change.
  141. -- Notes:   This is called for all weapon spawns the player has
  142. --          This is also called with player 255 when vehicles are being assigned weapons.
  143. --          This is only considered if in gametype, the weapon set is 'generic' if not this has no effect.
  144. function OnWeaponAssignment(player, object, count, tag)
  145. end
  146.  
  147. -- Called when an object is created
  148. -- Do not return a value.
  149. function OnObjectCreation(m_objectId, player_owner, tag)
  150. end
  151.  
  152. function object_in_sphere(X, Y, Z, R, m_objectId)
  153.     local Pass = false
  154.     if getobject(m_objectId) ~= nil then
  155.         local x,y,z = getobjectcoords(m_objectId)
  156.         if (X - x)^2 + (Y - y)^2 + (Z - z)^2 <= R then
  157.             Pass = true
  158.             --say("Successfully into the specified location defined in the table!")
  159.         end
  160.     end
  161.     return Pass
  162. end
Add Comment
Please, Sign In to add comment