Advertisement
th3w1zard1

OnCamoAssignment function

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