rockbandcheeseman

Mmmm dat Action

Nov 23rd, 2012
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 6.02 KB | None | 0 0
  1. action = {}
  2.  
  3.  
  4.  
  5.  
  6. function GetRequiredVersion()
  7.     return 10058
  8. end
  9.  
  10. -- called when the script is loaded
  11. function OnScriptLoad(process)
  12. end
  13.  
  14. -- called when the script is unloaded
  15. -- Do not return a value
  16. function OnScriptUnload()
  17. end
  18.  
  19. -- called when a game is starting (before any players join)
  20. -- Do not return a value.
  21. function OnNewGame(map)
  22. end
  23.  
  24. -- called when a game is ending
  25. -- Do not return a value.
  26. function OnGameEnd(mode)
  27.     -- mode 1 = score menu (F1) is being displayed to clients, they are still ingame
  28.     -- mode 2 = post game menu appeared
  29.     -- mode 3 = players can quit via the post game score card
  30. end
  31.  
  32. -- Called when there is chat within the server
  33. -- It must return a value which indicates whether or not the chat is sent.
  34. function OnServerChat(player, chattype, message)
  35.     return 1
  36. end
  37.  
  38. -- Called when a server command is being executed
  39. -- It must return a value which indicates whether or not the command should be processed
  40. -- Note: It is only called when an authenticated (and allowed) player attempts to use the command.
  41. --       player is -1 when being executed via the server console.
  42. function OnServerCommand(player, command)
  43.     return 1
  44. end
  45.  
  46. -- Called when a player's team is being chosen as the join the server.
  47. -- It must return a value which indicates the team the player is to be put on.
  48. -- Note: this function being called doesn't guarantee that the player will be able to successfully join.
  49. function OnTeamDecision(cur_team)
  50.     return cur_team
  51. end
  52.  
  53. -- Called when a player joins the server.
  54. -- Do not return a value.
  55. function OnPlayerJoin(player, team)
  56. end
  57.  
  58. -- Called when a player the server.
  59. -- Do not return a value.
  60. function OnPlayerLeave(player, team)
  61. end
  62.  
  63. -- called when a player kills another, 'killer' is the index of the killing player, 'victim' is the index of the dead player
  64. -- Do not return a value.
  65. function OnPlayerKill(killer, victim, mode)
  66. end
  67.  
  68. -- called when a player gets a double kill, killing spree etc
  69. -- see Phasor documentation for multiplier values
  70. function OnKillMultiplier(player, multiplier)
  71. end
  72.  
  73. -- Called when a player s (after object is created, before players are notified)
  74. -- Do not return a value
  75. function OnPlayerSpawn(player, m_objectId)
  76. end
  77.  
  78. -- Called after clients have been notified of a player spawn
  79. -- Do not return a value
  80. function OnPlayerSpawnEnd(player, m_objectId)
  81.  
  82. end
  83.  
  84. -- Called when a player is attempting to .
  85. -- A value must be returned. The return value indicates whether or not the player is allowed the change team.
  86. -- Notes: If relevant is 1 the return value is considered, if it's 0 then the return value is ignored.
  87. function OnTeamChange(relevant, player, team, dest_team)
  88.     return 1
  89. end
  90.  
  91. -- This is called when a client sends the server an update packet.
  92. -- This includes things such as movement vectors, camera positions, button presses etc.
  93. -- This function is called frequently so care should be taken to keep processing
  94. -- to a minimum.
  95. -- Do not return a value
  96. function OnClientUpdate(player, m_objectId)
  97.  
  98.  
  99. end
  100.  
  101. -- Called when a player interacts with an object
  102. -- It can be called while attempting to pick the object up
  103. -- It is also called when standing above an object so can be called various times quickly
  104. function OnObjectInteraction(player, m_ObjectId, tagType, tagName)
  105.  
  106.     local id = resolveplayer(player)
  107.     local m_object = getobject(m_ObjectId)
  108.     local m_playerObjId = getplayerobjectid(player)
  109.  
  110.     local interaction = readdword(getplayer(player), 0x24) -- Are they interacting with anything
  111.     local actionkey = readbit(m_object, 0x208, 1) -- 1 when the action key is pressed
  112.     local actionkey2 = readbit(m_object, 0x209, 5) -- e press
  113.     if interaction ~= 0xFFFFFFFF and interaction ~= 0 and (actionkey == 1 or actionkey2 == 1) then
  114.         action[id] = OnPlayerAction(player, m_playerObjId, tagType, tagName)
  115.     elseif getobject(readdword(m_object, 0x11C)) ~= nil and (actionkey == 1 or actionkey2 == 1) then
  116.         action[id] = OnPlayerAction(player, m_playerObjId, tagType, tagName)
  117.     end
  118.  
  119.     -- Code for blocking actions here, don't modify
  120.     if action[id] == 0 then
  121.         writebit(m_object, 0x208, 1, 0) -- will block using the action key (syncs (i think))
  122.         writebit(m_object, 0x209, 5, 0)
  123.     end
  124.    
  125.     return 1
  126. end
  127.  
  128. -- Called when a player attempts to reload their weapon.
  129. -- A value must be returned. The return value indicates whether or not the player is allowed to reload.
  130. -- Notes: If player is -1 then the weapon being reload wasn't located (it could be a vehicle's weapon)
  131. function OnWeaponReload(player, weapon)
  132.     return 1
  133. end
  134.  
  135. -- Called when a player attempts to enter a vehicle.
  136. --The return value indicates whether or not the player is allowed to enter.
  137. function OnVehicleEntry(relevant, player, vehicleId, vehicle_tag, seat)
  138.     return 1
  139. end
  140.  
  141. -- Called when a player is being ejected from their vehicle
  142. -- Return 1 or 0 to allow/block it.
  143. function OnVehicleEject(player, forceEject)
  144.     return 1
  145. end
  146.  
  147.  
  148. -- Called when damage is being done to an object.
  149. -- This doesn't always need to be a player.
  150. -- Do not return a value
  151. function OnDamageLookup(receiving_obj, causing_obj, tagdata, tagname)
  152. end
  153.  
  154. -- Called when a player is being assigned a weapon (usually when they spawn)
  155. -- 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.
  156. -- Notes:   This is called for all weapon spawns the player has
  157. --          This is also called with player 255 when vehicles are being assigned weapons.
  158. --          This is only considered if in gametype, the weapon set is 'generic' if not this has no effect.
  159. function OnWeaponAssignment(player, object, count, tag)
  160. end
  161.  
  162. -- Called when an object is created
  163. -- Do not return a value.
  164. function OnObjectCreation(m_objectId, player_owner, tag)
  165. end
  166.  
  167. -- Called when the player does an action by pressing E (picking up weapons, entering/exiting vehicles)
  168. -- This function can be blocked, return 0.
  169. -- This action syncs with certain actions, but not others.
  170. function OnPlayerAction(player, m_playerObjId, tagType, tagName)
  171.     return 1
  172. end
Advertisement
Add Comment
Please, Sign In to add comment