SHARE
TWEET

SAPP Lua Template

liquidspark Jan 3rd, 2017 296 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- SAPP_LUA_SCRIPTING_TEMPLATE
  2. -- by Sparky (noman@example.com)
  3. -- March 29, 2016
  4.  
  5. -- Best viewed with Notepad++ so that the comment sections can collapse and the text indentation is kept.
  6.  
  7. --[=[   Quick Reference
  8.  
  9. ---
  10. GENERAL
  11. ---[[
  12.  
  13. lua_call <script name> <function name> [arguments]
  14.    
  15.     Call a function in this file from elsewhere within SAPP.
  16.  
  17. --]]
  18.  
  19. ---
  20. GAME FUNCTIONS
  21. ---[[
  22.        
  23. assign_weapon(number ObjectID, number PlayerIndex)
  24.    
  25.     This function assigns a weapon to a player. The player may have at most four weapons. This function will return false if the player was not given the weapon.
  26.  
  27.     Returns: boolean Success
  28.  
  29. camo(number PlayerIndex, number DurationTicks)
  30.  
  31.     This function applies active camouflage for a specified amount of time. There are 30 ticks in a second. Active camouflage cannot be removed from the player once given.
  32.  
  33. cprint(string Message)
  34.  
  35.     This function prints a message to the console.
  36.  
  37. destroy_object(number ObjectID)
  38.  
  39.     This function removes the object. Removing gametype-specific objects like oddballs or flags, and removing vehicles that were not spawned using SAPP may result in crashing Halo. Destroying a living player's object will cause that player to respawn.
  40.  
  41. drop_weapon(number PlayerIndex)
  42.  
  43.     This function drops the player's current weapon.
  44.  
  45. enter_vehicle(number ObjectID, number PlayerIndex, number Seat)
  46.  
  47.     This function forces the player to enter the specified object's seat. It returns true if the entry was successful.
  48.  
  49.     Returns: boolean Success
  50.  
  51. execute_command(string Command, optional number PlayerIndex, optional boolean Echo)
  52.  
  53.     This function executes a command on the console or as PlayerIndex if specified. It can be a SAPP command, a custom command, a Halo command, or a cheat command. If Echo is true, then the function raises EVENT_ECHO as well. This function will return a boolean of true if the command was successful, or false if it was not.
  54.  
  55.     Returns: boolean Success
  56.  
  57. execute_command_sequence(string Command, optional number PlayerIndex, optional boolean Echo)
  58.  
  59.     This function executes a sequence of commands separated by semicolons. These commands will be executed on the console or as PlayerIndex if specified. Each command can be a SAPP command, a custom command, a Halo command, or a cheat command. If Echo is true, then the function raises EVENT_ECHO as well. Unlike execute_command, this function does not return anything.
  60.  
  61. exit_vehicle(number PlayerIndex)
  62.  
  63.     This function forces the player to exit their vehicle.
  64.  
  65. get_dynamic_player(number PlayerIndex)
  66.  
  67.     This function retrieves the address of the player object, or 0 if the player is not alive. This value will change if the player dies or leaves the game.
  68.  
  69.     Returns: number PlayerObjectAddress
  70.  
  71. get_object_memory(number ObjectID)
  72.  
  73.     This function retrieves the address of the object, or 0 if the object does not exist.
  74.  
  75.     Returns: number PlayerObjectAddress
  76.  
  77. get_player(number PlayerIndex)
  78.  
  79.     This function retrieves the memory address of the player table entry.
  80.  
  81.     Returns: number PlayerTableAddress
  82.  
  83. get_var(number PlayerIndex, string Variable)
  84.  
  85.     This function retrieves an event variable, or a custom variable set by var_add.
  86.  
  87.     Returns: string Value
  88.  
  89. intersect(number VectorX1, number VectorY1, number VectorZ1, number VectorX2, number VectorY2, number VectorZ2, optional number ObjectID)
  90.  
  91.     This function checks for a collision intersection between two vectors, with the second vector being relative to the first one. ObjectID is the object to ignore. If Success is false, then all of the other return values are nil. If no object was hit, but there was still a collision, then the returned ObjectID will be 0xFFFFFFFF.
  92.  
  93.     Returns: boolean Success, number CollisionX, number CollisionY, number CollisionZ, number CollisionObjectID
  94.  
  95. kill(number PlayerIndex)
  96.  
  97.     This function will kill the player as well as increase their death count by 1.
  98.  
  99. lookup_tag(number MetaID)
  100.  
  101.     This function returns the address of a tag using the tag's ID.
  102.  
  103.     Returns: number TagAddress
  104.  
  105. lookup_tag(string TagClass, string TagName)
  106.  
  107.     This function returns the address of a tag using the tag's class and name.
  108.  
  109.     Returns: number TagAddress
  110.  
  111. player_alive(number PlayerIndex)
  112.  
  113.     This function returns true if the player is alive; false if not.
  114.  
  115.     Returns: boolean PlayerIsAlive
  116.  
  117. player_present(number PlayerIndex)
  118.  
  119.     This function returns true if the player is on the server; false if not.
  120.  
  121.     Returns: boolean PlayerIsPresent
  122.  
  123. powerup_interact(number ObjectID, number PlayerIndex)
  124.  
  125.     This function assigns a powerup to a player.
  126.  
  127.     Returns: boolean Success
  128.  
  129. rand(optional number Minimum, optional number Maximum)
  130.  
  131.     This function generates a random number between Minimum (including) and Maximum (excluding). If unspecified, the values of Minimum and Maximum are 0 and 231, respectively.
  132.  
  133.     Returns: number RandomNumber
  134.  
  135. register_callback(number CallbackID, string CallbackFunctionName)
  136.  
  137.     This function registers a function that will be called every time the event is called. You may only have one function registered per event. Callback IDs are in the cb global variable and are retrieved using cb[“EVENT_ID”].
  138.  
  139. rprint(number PlayerIndex, string Message)
  140.  
  141.     This function sends an rcon message to a specific player.
  142.  
  143. say(number PlayerIndex, string Message)
  144.  
  145.     This function sends a chat message to a specific player.
  146.  
  147. say_all(string Message)
  148.  
  149.     This function sends a chat message to all players.
  150.  
  151. sig_scan(string Signature)
  152.  
  153.     This function scans Halo's code for the given masked signature (e.g. "83EC??568BF0A0????????84C00F84"). Spaces are not allowed and ?? are masked bytes which can match anything. Signatures cannot start with masked bytes. If the signature was not found, then 0 is returned instead.
  154.  
  155.     Returns: number Address
  156.  
  157. spawn_object(string TagType, string TagPath, optional number X, optional number Y, optional number Z, optional number Rotation, optional number TagID)
  158.  
  159.     This function spawns an object at the specified coordiantes. If TagID is specified, then TagType and TagPath are not read and effectively become optional arguments. It will return the Object ID of the spawned object.
  160.  
  161.     Returns: number ObjectID
  162.  
  163. sync_ammo(number ObjectID)
  164.  
  165.     This function syncs the ammo for the object in the case that either the magazine or the remaining ammo was changed. It will not sync the battery age or heat of the weapon.
  166.  
  167. timer(number Milliseconds, string FunctionName, optional string Arguments, ...)
  168.  
  169.     This function creates a timer that executes a function after a delay. If the timer function returns true, then the timer repeats.
  170.  
  171. to_player_index(number RealPlayerIndex)
  172.  
  173.     This function converts a player's table index (used by player tables [0-15]) to the player's rcon index (used by SAPP and commands [1-16]).
  174.  
  175.     Returns: number PlayerIndex
  176.  
  177. to_real_index(number PlayerIndex)
  178.  
  179.     This function converts a player's rcon index (used by SAPP and commands [1-16]) to the player's table index (used by player tables [0-15]).
  180.  
  181.     Returns: number RealPlayerIndex
  182.  
  183. unregister_callback(number CallbackID)
  184. unregister_callback(cb[<EVENT_ID>])
  185.     This function unregisters an event that was registered with the register_callback function. Callback IDs are in the cb global variable and are retrieved using cb[“EVENT_ID”].
  186.  
  187. --]]
  188.  
  189. ---
  190. VIRTUAL MEMORY FUNCTIONS
  191.  
  192.     These functions are for more advanced scripts that require directly editing the game's memory. If used improperly, these functions can easily crash the server. safe_read and safe_write are provided to prevent a segmentation fault when reading/writing data, but they will not protect the server from crashing if invalid values or instructions are written, and they can increase the time for reading and writing substantially.
  193.    
  194. ---[[
  195.  
  196. safe_read(boolean Enabled)
  197.  
  198.     Enabling safe reading will prevent invalid reading from crashing the server, at a significant cost of performance.
  199.  
  200. safe_write(boolean Enabled)
  201.  
  202.     Enabling safe reading will prevent invalid writing from crashing the server, as well as allow writing in read-only memory such as program instructions, at a significant cost of performance.
  203.  
  204. read_bit(number ReadAddress, number Bit)
  205.  
  206.     This function retrieves a bit from an unsigned 8-bit integer, or nil if failed. May crash server on failure if safe_read is off.
  207.  
  208.     Returns: number Value
  209.  
  210. read_byte(number ReadAddress)
  211.  
  212.     This function retrieves an unsigned 8-bit integer, or nil if failed. May crash server on failure if safe_read is off.
  213.  
  214.     Returns: number Value
  215.  
  216. read_char(number ReadAddress)
  217.  
  218.     This function retrieves a signed 8-bit integer, or nil if failed. May crash server on failure if safe_read is off.
  219.  
  220.     Returns: number Value
  221.  
  222. read_word(number ReadAddress)
  223.  
  224.     This function retrieves an unsigned 16-bit integer, or nil if failed. May crash server on failure if safe_read is off.
  225.  
  226.     Returns: number Value
  227.  
  228. read_short(number ReadAddress)
  229.  
  230.     This function retrieves a signed 16-bit integer, or nil if failed. May crash server on failure if safe_read is off.
  231.  
  232.     Returns: number Value
  233.  
  234. read_dword(number ReadAddress)
  235.  
  236.     This function retrieves an unsigned 32-bit integer, or nil if failed. May crash server on failure if safe_read is off.
  237.  
  238.     Returns: number Value
  239.  
  240. read_int(number ReadAddress)
  241.  
  242.     This function retrieves a signed 32-bit integer, or nil if failed. May crash server on failure if safe_read is off.
  243.  
  244.     Returns: number Value
  245.  
  246. read_float(number ReadAddress)
  247.  
  248.     This function retrieves a single-precision (32-bit) floating point number, or nil if failed. May crash server on failure if safe_read is off.
  249.  
  250.     Returns: number Value
  251.  
  252. read_double(number ReadAddress)
  253.  
  254.     This function retrieves a double-precision (64-bit) floating point number, or nil if failed. May crash server on failure if safe_read is off.
  255.  
  256.     Returns: number Value
  257.  
  258. read_vector3d(number ReadAddress)
  259.  
  260.     This function retrieves three single-precision floating point numbers, or nil if failed. May crash server on failure if safe_read is off.
  261.  
  262.     Returns: number ValueX, number ValueY, number ValueZ
  263.  
  264. read_string(number ReadAddress)
  265.  
  266.     This function retrieves an 8-bit null-terminated character string at an address, or nil if failed. May crash server on failure if safe_read is off.
  267.  
  268.     Returns: string Value
  269.  
  270. write_bit(number WriteAddress, number Bit, number Value)
  271.  
  272.     This function writes a bit to an unsigned 8-bit integer. May crash server on failure if safe_write is off.
  273.  
  274.     Returns: boolean Success
  275.  
  276. write_byte(number WriteAddress, number Value)
  277.  
  278.     This function writes an unsigned 8-bit integer. May crash server on failure if safe_write is off.
  279.  
  280.     Returns: boolean Success
  281.  
  282. write_char(number WriteAddress, number Value)
  283.  
  284.     This function writes a signed 8-bit integer. May crash server on failure if safe_write is off.
  285.  
  286.     Returns: boolean Success
  287.  
  288. write_word(number WriteAddress, number Value)
  289.  
  290.     This function writes an unsigned 16-bit integer. May crash server on failure if safe_write is off.
  291.  
  292.     Returns: boolean Success
  293.  
  294. write_short(number WriteAddress, number Value)
  295.  
  296.     This function writes a signed 16-bit integer. May crash server on failure if safe_write is off.
  297.  
  298.     Returns: boolean Success
  299.  
  300. write_dword(number WriteAddress, number Value)
  301.  
  302.     This function writes an unsigned 32-bit integer. May crash server on failure if safe_write is off.
  303.  
  304.     Returns: boolean Success
  305.  
  306. write_int(number WriteAddress, number Value)
  307.  
  308.     This function writes a signed 32-bit integer. May crash server on failure if safe_write is off.
  309.  
  310.     Returns: boolean Success
  311.  
  312. write_float(number WriteAddress, number Value)
  313.  
  314.     This function writes a single-precision (32-bit) floating point number. May crash server on failure if safe_write is off.
  315.  
  316.     Returns: boolean Success
  317.  
  318. write_double(number WriteAddress, number Value)
  319.  
  320.     This function writes a double-precision (64-bit) floating point number. May crash server on failure if safe_write is off.
  321.  
  322.     Returns: boolean Success
  323.  
  324. write_vector3d(number WriteAddress, number ValueX, number ValueY, number ValueZ)
  325.  
  326.     This function writes three single-precision floating point numbers. May crash server on failure if safe_write is off.
  327.  
  328.     Returns: boolean Success
  329.  
  330. write_string(number WriteAddress, string Value)
  331.  
  332.     This function writes an 8-bit null-terminated character string at an address. May crash server on failure if safe_write is off.
  333.  
  334.     Returns: boolean Success
  335. --]]
  336.  
  337. ---
  338. EVENT VARIABLES
  339. ---[[
  340.  
  341. $n - PlayerIndex from sv_players / pl
  342. $name - Player's name
  343. $hash - Player's cd-key hash
  344. $ip - Player's ip
  345. $tk - Player's TK (betray) count
  346. $kills - Player's kill count
  347. $assists - Player's assist count
  348. $deaths - Player's death count
  349. $suicides - Player's suicide count
  350. $streak - Killstreak count of the player (number of kills without die)
  351. $combo - Combo count, like 2: double kill, 3: triple kill etc.
  352. $score - Player's CTF/Slayer score count
  353. $botscore - The player's current aimbot score
  354. $afk - Player's afk timer
  355. $ping - Player's ping
  356. $x - Player's x coordinate
  357. $y - Player's y coordinate
  358. $z - Player's z coordinate
  359. $hp - Player's health
  360. $sh - Player's shield
  361. $invis - 0: Player is visible, 1: Player is invisible
  362. $team - Player's team
  363. $oteam - Opposite team of the player
  364. $lvl - Admin level of the player, not admin: -1, admin : 0 to 4
  365. $map - The name of the current map
  366. $mode - The name of the current gamemode
  367. $gt - The type of the current game (ex: ctf, slayer, etc.)
  368. $ffa -  0: Team game, 1: FreeForAll
  369. $svname - The name of the server
  370. $redscore - The score of the read team
  371. $bluescore - The score of the blue team
  372. $pn - The number of the players in the server
  373. $reds - The number of the players in the red team
  374. $blues - The number of the players in the blue team
  375. $rand - Gives a random number from 1 to 16
  376.  
  377. --]]
  378.  
  379. ---
  380. CUSTOM VARIABLES
  381.  
  382.     You can use custom variables to store text/numbers and use them for more flexible modding. Their value can be used in the event system with adding a "$" before their name, using them like the generic event variables. They can be also used in custom commands in the same way.
  383.  
  384. ---[[
  385.  
  386. var_add <name> <type>
  387.  
  388.     Adds a new variable, where:
  389.        
  390.         type =
  391.        
  392.             0 - global string
  393.             1 - global int
  394.             2 - global float
  395.             3 - player string
  396.             4 - player int
  397.             5 - player float
  398.  
  399.     Global ones are containing only 1 variable, while player ones have a different variable for each player, tied to their player ID.
  400.  
  401. var_del <name>
  402.  
  403.     Deletes the given variable.
  404.  
  405. var_set <name> <value_expression> [player_number]
  406.  
  407.     Sets a given value, player_number is only required for player variables.
  408.  
  409. var_conv <name>
  410.  
  411.     Converts int variable to float and vice-versa, not available for string.
  412.    
  413. var_list
  414.  
  415.     Lists all variable names and their types. For extremely long lists of 2048 or more variables, will lag and potentially crash the game server. (A more optimal approach to manage lots of player information is to store it in a text file and load into memory only values relevant to the currently connected 16 players.)
  416.  
  417. --]]
  418.  
  419. ---
  420. COMMAND PLAYER-MATCHING EXPRESSIONS
  421. ---[[
  422.  
  423. 'number' - Matches player with given number (from pl command).
  424. * - Matches all players.
  425. *Alan* - Matches all players with Alan in name. (Case-sensitive)
  426. me - Matches the player who is executing the command.
  427. rt - Matches all players on red team.
  428. bt - Matches all players on blue team.
  429. pl - Matches all regular players (non-admins).
  430. admin - Matches all admins.
  431. rand - Will pick a random player.
  432. randred - Will pick a random player from the red team.
  433. randblue - Will pick a random player from the blue team.
  434.  
  435. --]]
  436.  
  437. ---
  438. PLAYER COMMANDS
  439. ---[[
  440.  
  441. info
  442.    
  443.     Shows server name, amount of players, map, gametype and if scim mode is enabled or not.
  444.  
  445. stats
  446.    
  447.     Shows your kills, assists, deaths, your kill/death ratio and the time since you are playing in the server.
  448.  
  449. sv_stats
  450.    
  451.     Displays some cool stats about the server.
  452.  
  453. about
  454.    
  455.     Tells you the sapp version, and who made sapp.
  456.  
  457. whatsnext
  458.    
  459.     Tells you the next map and gametype if there is sapp mapcycle set.
  460.  
  461. login
  462.    
  463.     "V2" Admins can log in with this command so they can use chat too to execute admin commands. Also if Sapp-rcon is disabled (not recommended) players can log-in with the default rcon password.
  464.  
  465. afk
  466.    
  467.     Only if enabled by the server admin (set its level to -1): You won't respawn after you died until you type this command again (So you can't be afk-killed).
  468.  
  469. lead [enabled]
  470.    
  471.     Tells you if no-lead mode is enabled, if yes you can turn it off and on again for yourself.
  472.  
  473. clead [ping]
  474.    
  475.     If no-lead mode is enabled, you can set custom lead for yourself, but only lower or equal to your ping.
  476.  
  477.     For example if you have 200 ms ping, but you only want to lead 66 ms, then use /clead 66 command in the chat.
  478.  
  479. stfu
  480.    
  481.     Blocks every server and rcon message to you which is generated by events or scripts.
  482.  
  483. unstfu
  484.    
  485.     Unblocks every server and rcon message to you which is generated by events or scripts.
  486. --]]
  487.  
  488. ---
  489. SERVER CONFIGURATION COMMANDS
  490. ---[[
  491.  
  492. setcmd <command> <name/level>
  493.    
  494.     Set the name/level of the given command.
  495.  
  496.     Example: setcmd k kick this will change 'k' command to 'kick'
  497.  
  498.     setcmd k 3 this will change 'k' (kick) command's level to level 3
  499.  
  500. anticheat [enabled]
  501.    
  502.     Enables anticheat mode, when only clients with anticheat can play in the server. Only possible to use it from sapp's init.txt, once it enabled, can't be disabled until you restart the server.
  503.  
  504. say_prefix [enabled]
  505.    
  506.     Enable / Disable "** SERVER **" prefix on server messages
  507.  
  508. msg_prefix <string>
  509.    
  510.     You can set a custom prefix instead of ** SERVER **. Ex: msg_prefix "** SAPP ** " (default), msg_prefix "" = no prefix
  511.  
  512. admin_prefix <string>
  513.    
  514.     Prefix used for messages by the admins with the say command etc. Default is "** ADMIN ** "
  515.  
  516. cmdstart1 [character]
  517.    
  518.     This will set the character that used to run admin commands from the chat (if you have admin rights ofc), default is '\'
  519.  
  520.     For ex in the chat: \pl, \sv_kick 4, or \k 4 noob
  521.  
  522. cmdstart2 [character]
  523.    
  524.     Secondary cmdstart, default is '/'
  525.  
  526. sapp_rcon [enabled]
  527.    
  528.     If enabled, only sapp admins can use the rcon, v1 admins with the default rcon password, v2 admins with their own password. Bruteforce protection is always active even if this function is disabled.
  529.  
  530. sapp_mapcycle [enabled]
  531.    
  532.     If enabled, sapp will use the mapcycle you specified in the mapcycle.txt, read more on the "Sapp Mapcycle" page.
  533.  
  534. map_skip [value]
  535.    
  536.     Players can type 'skip' to the chat to skip to the next map. The value is the % of the required votes to skip.
  537.  
  538.     Value can be between 40 and 100 or 0 to disable map skipping.
  539.  
  540. mapvote [enabled]
  541.    
  542.     Enables/disables map voting. See "Map Vote" page for more information.
  543.  
  544. max_votes [number]
  545.    
  546.     Specify the amount of displayed mapvotes / round, default value is 5.
  547.  
  548.     Sapp now cycles the mapvotes, instead of showing all the 8-12+ in the same time. For ex. if the "max_votes" is 5, then the players only can vote for the first 5 options, and after the voted game ended, they can choose from the next 5 option in the end of the next round, etc.
  549.  
  550. ping_kick [ping]
  551.    
  552.     If player's ping is higher than [ping] for about 20 seconds, he's kicked. However, player who just joined the game and his ping is high for a while is not punished by this feature. Admins are not kicked, if [ping] is 0 then ping kicking is disabled.
  553.  
  554. afk_kick [time]
  555.    
  556.     AFK players (unless they are admins) are kicked after a given period of inactivity (in seconds), if [time] is 0 then afk kicking is disabled.
  557.  
  558. disable_sj [enabled]
  559.    
  560.     Disables the usage of SightJacker for HAC users like in ScrimMode.
  561.  
  562. sj_admin_level [level]
  563.    
  564.     Enables the usage of HAC2's SightJacker for players with at least the given admin level, value can be between 0 and 5, default value is 5, which means no one can use SJ.
  565.  
  566. zombies [team]
  567.    
  568.     This will give some information for a future HAC2 with new medals about which team is the Zombies team. 0 - none, 1 - red, 2 - blue
  569.  
  570. scrim_mode [enabled]
  571.    
  572.     If enabled, no one can execute any naughty commands.
  573.  
  574.     Server sends a message to every player if this status is changed.
  575.  
  576.     You can also check it's status with the info command.
  577.  
  578. no_lead [enabled]
  579.    
  580.     Enables/disables the no_lead mode for everyone. You can check and change the state of leading with the lead command.
  581.  
  582.     If the admins didn't enable no-lead mode, you can't turn it on for yourself, but if they enabled it, everyone can disable this mod for themselves by typing lead 1 to the chat. Also, you can re-enable it with the lead 0 command.
  583.  
  584. collect_aliases [enabled] [valid_only]
  585.    
  586.     If this function is enabled Sapp will track what other names a player used in your server. If valid_only is true, then it will only collect aliases for valid CD-Keys.
  587.  
  588. alias <player_expr>
  589.    
  590.     Displays all the names that the player used in your server. Note that you have to enable collecting aliases first with the collect_aliases 1 command (put it to the sapp's init.txt) otherwise this function won't work.
  591.  
  592. adminban [type]
  593.    
  594.     Type:0 Admin can kick/ban another admin. (default)
  595.  
  596.     Type:1 Admin can't kick/ban another admin with higher level.
  597.  
  598.     Type:2 Admin can't kick/ban another admin with higher or equal level.
  599.  
  600. adminadd_samelevel [value]
  601.    
  602.     The value is 0 by default, if set to 1, admins can add other players as admin with the adminadd command with lower level than them, if value is set to 2, admins can add others as admin with lower or equal level.
  603.  
  604. admindel_samelevel [value]
  605.    
  606.     The value is 0 by default, if set to 1, admins can delete other players as admin with the admindel command with lower level than them, if value is set to 2, admins can delete others as admin with lower or equal level.
  607.  
  608. anticaps [enabled]
  609.    
  610.     OVERUSING CAPS LOCK IS PUNISHED WITH lowercase text
  611.  
  612. antispam [type]
  613.    
  614.     Players, who spam the chat usually with spam-bot, will get type: 1 - textban (cd-key based), type: 2 - mute (ip-based)
  615.  
  616. antihalofp [enabled]
  617.    
  618.     IP trying to connect to the server more than 8 times in a short time period will be added to IP banlist for 5 minutes. (recommended)
  619.  
  620. anticamp [time(s)] [distance(u)]   
  621.  
  622.     Raises event_camp <killnumber> 'command' event. For ex. anticamp 30 5 : if the distance between the player's coordinates is less than 5 world units (1 world unit ~ 10 feet or 3.05 meters) in the last 30 sec, it will raise event_camp event with the number of the kills he did while he was in this "camping stage".
  623.  
  624.     Note: You walk about 3 world unit per second when moving forward at default speed.
  625.  
  626.     Example events:
  627.  
  628.         event_camp 3 'say $n "$name Please change your position!"'
  629.  
  630.         event_camp 4 'say $n "$name stop camping or you will be kicked!"'
  631.  
  632.         event_camp 5 'say * "Warning! $name will be kicked for camping!"'
  633.  
  634.         event_camp 6 'k $n Camping'
  635.  
  636. antiwarp [warp_num]
  637.    
  638.     Raises an event_warp after the player warped "warp_num" times. Recommended value: 5, 0 means this function is disabled.
  639.  
  640.     Example:
  641.  
  642.         sapp's init.txt:
  643.  
  644.             antiwarp 5
  645.  
  646.         events.txt:
  647.  
  648.             event_warp 'kill $n;say $n "You were killed because you are warping."'
  649.  
  650. spawn_protection [time]
  651.  
  652.     Spawn Protection. For Example with spawn_protection 5 players will be invincible in the first 5 seconds (or till the first shot) after spawning.
  653.  
  654.     Value can be between 1 and 10 (and 0 to disable spawn protection)
  655.  
  656. aimbot_ban [value] [type]
  657.    
  658.     Players will get scores for "suspect" movements. If a players score is higher than the aimbot_ban value, he/she will be banned =)
  659.  
  660.     Type -> 0 - Normal Ban, 1 - IP Ban (default), 2 - both, 3 - kick only
  661.  
  662.     Note that you WON'T get banned if you are shaking your camera like a retarded or killing 15 ppl in half second, etc.
  663.  
  664.     Value can be between 5000 and 20000. (The less the value, the faster the ban is but more risk for false positives.)
  665.  
  666. antiglitch [enabled]
  667.    
  668.     Kills the player if he is out of the BSP, useful in maps such as Danger Canyon or Coldsnap. Thx for 002 for this great find.
  669.  
  670. save_scores [enabled]
  671.    
  672.     If enabled, SAPP will save the player's score of the current game, in case if he/she is lag out etc., the player wont lose his/her score/kills/assists/deaths
  673.  
  674. block_tc [enabled]
  675.    
  676.     If enabled players are always blocked from changing their team.
  677.  
  678. log [enabled]
  679.    
  680.     Enable / Disable SAPP logging.
  681.  
  682. log rotation [kb]
  683.    
  684.     Sets the size of the log file after it gets archived. Default value is 4096 (kb).
  685.  
  686. log_name [name]
  687.    
  688.     You can specify custom log name. Note that name is without the ".log" file extension.
  689.  
  690. packet_limit [amount]
  691.    
  692.     Gives basic DoS protection to the server. If the server receives more packets in 1 second than specified with "amount" Sapp automatically bans the IP. Minimum value is 256, default is 1024, 0 = disabled.
  693.  
  694. full_ipban [enabled]
  695.    
  696.     If enabled, all packets from the banned IPs will be blocked, otherwise only join requests and server queries. This function is disabled by default, enabling it with a huge ipban list can cause the server lag and the pings increase.
  697.  
  698. subtract_afks [enabled]
  699.    
  700.     If enabled, the number AFK players will be subtracted in the player number on the server list, except if the server is full).
  701.  
  702. sapp_console [enabled]
  703.    
  704.     Disables the sv_status spam and instead displays when a player joins/leaves or a new game starts.
  705.  
  706. console_input [enabled]
  707.    
  708.     If disabled, the console won't accept any input, this slightly improves reg, mostly useful in servers at hosting companies, where you don't have access to the console anyways. Default value: 1
  709.  
  710. unlock_console_log <enabled>
  711.    
  712.     If enabled, unlock some stuff in the memory and console will be more "chatty" :P It will inform you from everything like player join, kill, betray, flag capture etc. (CE version only)
  713.  
  714. chat_console_echo [enabled]
  715.    
  716.     If enabled, chat messages will shown in the console window.
  717.  
  718. set_ccolor [value]
  719.    
  720.     Set the color of the console text (0-255), 0-15 with black background. Default is 7 (gray text on black background)
  721.  
  722. max_idle [time]
  723.    
  724.     If the server is idle for more than "time" seconds Sapp automatically restarts the mapcycle. Default is 60, 0 = disabled.
  725.  
  726. custom_sleep [value]
  727.    
  728.     Set the amount that the Halo thread Sleeps every cycle, to use the default speed set it to 0 (with the "33 pings"), default value is 8. Changing this value can improve reg, but very low values like 1 can cause low ping players desync. Note that this has no effect on physics processing or network traffic rate.
  729.  
  730. v [version]
  731.    
  732.     Displays/sets the current version of the server.
  733.  
  734. dns [url]
  735.    
  736.     Displays/sets the current master server DNS.
  737.  
  738. --]]
  739.  
  740. ---
  741. NORMAL SERVER COMMANDS
  742.  
  743.     All the Halo devmode commands are also available.
  744.    
  745. ---[[
  746.  
  747. load
  748.  
  749.     Loads server plugin (sapp.dll), commands listed below are available only if 'load' had been issued before.
  750.  
  751. unload
  752.    
  753.     Unloads server app, useful when new version of sapp.dll is released :-) and you want to perform update without restarting server.
  754.  
  755. reload
  756.    
  757.     Reload all sapp files.
  758.  
  759. pl
  760.    
  761.     = sv_players + players/max slot
  762.  
  763. bans
  764.    
  765.     = sv_banlist
  766.  
  767. map <map> <gametype>
  768.    
  769.     = sv_map with an extra feature that it will cancels mapvote for that round
  770.  
  771. maplist
  772.    
  773.     = sv_maplist just with 3 columns
  774.  
  775. say <player_expr> <message>
  776.    
  777.     Sends server messages to players matching player_expr.
  778.  
  779.     sv_say "message" = say * "message"
  780.  
  781.     Special sequences:
  782.        
  783.         \n will be replaced with name of player that receives message.
  784.        
  785.         \t will be replaced with name of his team.
  786.        
  787.         \o will be replaced with name of opposite team.
  788.  
  789. k <player_expr> [reason]
  790.    
  791.     Player will be kicked with a reason noticing the other players.
  792.    
  793.     Ex: k 4 moron
  794.            
  795.         ** server ** New 001 was kicked by the admin. Reason: moron
  796.  
  797. b <player_expr> [time] [reason]
  798.    
  799.     Player will be banned with a reason noticing the other players.
  800.    
  801.     Ex: b 4 h4x0r
  802.        
  803.         ** server ** New 001 was banned by the admin. Reason: h4x0r
  804.  
  805.  
  806. afks
  807.    
  808.     Displays inactivity periods (in seconds) of the players.
  809.  
  810. skips
  811.    
  812.     Displays a list about players who voted for skip the current map.
  813.  
  814. aimbot_scores
  815.    
  816.     Displays aimbot scores of all players in the server.
  817.  
  818. balance_teams
  819.    
  820.     This command will try to make the most equal teams based on kills, assists, deaths and TKs, with a two pass scoring system. ;-)
  821.  
  822.     Players who got team-switched won't get +1 death.
  823.  
  824. teamup
  825.    
  826.     Will set up the two teams based on the tags in the player names.
  827.  
  828.     This only works if at least one team has proper tags and all are the same, otherwise it won't be always 100% accurate.
  829.  
  830. refresh_ipbans
  831.    
  832.     Refresh IP-banlist and ipbans.txt.
  833.  
  834. change_password <old> <new>
  835.    
  836.     With this, v2 admins can change their own password.
  837.  
  838. inf <player_expr>
  839.    
  840.     Displays PlayerIndex, Name, IP and CD-Key Hash of the given players.
  841.  
  842. ip <player_number>
  843.    
  844.     Displays player's IP, Rev DNS and CD-Key hash.
  845.  
  846. d <player_number>
  847.    
  848.     Displays some shitty info about the player.
  849.  
  850. log_note <string>
  851.    
  852.     Writes a note into the SAPP log.
  853.  
  854. query_add <key> <value>
  855.    
  856.     Adds a new entry to the remote query string.
  857.    
  858.     For example:
  859.  
  860.         query_add xfire lgbalazs or query_add ventrilo 12.34.56.78:91011
  861.  
  862.     If a query already exists with the given name, it will be overwritten.
  863.  
  864. query_del <id/name>
  865.    
  866.     Deletes a custom remote query entry.
  867.  
  868. query_list
  869.    
  870.     Lists all the custom remote query entries.
  871.  
  872. files
  873.    
  874.     Lists the Sapp file locations and their encoding.
  875.  
  876. cpu
  877.    
  878.     Displays Processor brand string, and operating system version info.
  879.  
  880. uptime
  881.    
  882.     Displays uptime of sapp.dll and the operating system.
  883.  
  884. beep
  885.    
  886.     Beeepp!!! (beep <hz> <ms> ;)
  887.  
  888. about
  889.    
  890.     :*
  891.  
  892. --]]
  893.  
  894. ---
  895. SPECIAL SERVER COMMANDS
  896.  
  897.     Not available when scrim_mode is on.
  898.    
  899. ---[[
  900.  
  901. timelimit [amount]
  902.  
  903.     Changes the timelimit on the fly, value smaller than 1 means infinitive.
  904.  
  905. scorelimit [amount]
  906.  
  907.     Changes the scorelimit on the fly. Works with all gametypes, both FFA and Team games. Note that in special gametypes like KingOfTheHill or OddBall, amount is in minutes.
  908.  
  909. s <player_expr> [amount]
  910.  
  911.     Changes speed of given player, default speed is 1.
  912.    
  913.     Example:
  914.  
  915.         s 4 6 will changes speed of player 4 to 6.
  916.  
  917. st <player_expr> [red|blue]
  918.  
  919.     Changes team of player, if no team is given then team is switched to opposite. Player won't get +1 death. :)
  920.  
  921. kill <player_expr>
  922.  
  923.     Kills the player.
  924.  
  925. kills <player_expr> [amount]
  926.  
  927.     Sets the kills of the player.
  928.  
  929. assist <player_expr> [amount]
  930.  
  931.     Sets the assists of the player.
  932.  
  933. deaths <player_expr> [amount]
  934.  
  935.     Sets the deaths of the player.
  936.  
  937. ctf_score <player_expr> [amount]
  938.  
  939.     Sets the ctf score of the player.
  940.  
  941. slayer_score <player_expr>[amount]
  942.  
  943.     Sets the slayer / team slayer score of the player.
  944.  
  945. ctf_score_team <team_expr>[amount]
  946.  
  947.     Sets the ctf scores of the team.
  948.    
  949.     Ex:
  950.        
  951.         ctf_scores_team red 20, ctf_scores_team * 4
  952.  
  953. slayer_score_team <team_expr> [amount]
  954.  
  955.     Sets the team slayer scores of the team.
  956.  
  957. god <player_expr>
  958.  
  959.     Player will be invincible. =)
  960.  
  961. ungod <player_expr>
  962.  
  963.     Player can be killed.
  964.  
  965. lag <player_expr>
  966.  
  967.     Lag given player.
  968.  
  969. unlag <player_expr>
  970.  
  971.     Unlag given player.
  972.  
  973. camo <player_expr> [time]
  974.  
  975.     Makes the player invisible for the given time, if no time was specified, the player will be invisible until death.
  976.  
  977. coord <player_expr>
  978.  
  979.     Displays the coordinates of the given players.
  980.  
  981. loc add <location_name> <x> <y> <z>
  982.  
  983.     Adds new location to list.
  984.    
  985.     Example:
  986.  
  987.         loc add red_base 546.4 3.3 24.3
  988.  
  989. loc add <location_name>
  990.  
  991.     Adds current player position to location list.
  992.    
  993.     Example:
  994.  
  995.         loc add red_base
  996.  
  997. loc del <location_name>
  998.  
  999.     Remove location from list.
  1000.    
  1001.     Example:
  1002.  
  1003.         loc del red_base
  1004.  
  1005. loc list
  1006.  
  1007.     Lists locations from current map.
  1008.  
  1009. loc listall
  1010.  
  1011.     Lists locations from all maps. Locations are stored in the halo ce\sapp\locations.txt
  1012.  
  1013. area add_sphere <name> <x> <y> <z> <r>
  1014.  
  1015.     Adds a new sphere to the current map. x,y,z are the coordinates of the center of the sphere, r is the radius in world units.
  1016.  
  1017. area add_cuboid <name> <a_x> <a_y> <a_z> <b_x> <b_y> <b_z>
  1018.  
  1019.     Adds a new cuboid to the current map. The cuboid will between the given 'a'-'b' coordinates.
  1020.  
  1021. area del <name>
  1022.  
  1023.     Deletes an area from the current map.
  1024.  
  1025. area list
  1026.  
  1027.     Lists all the areas for the current map.
  1028.  
  1029. area listall
  1030.  
  1031.     Lists all the areas. Areas are stored in the halo ce\sapp\areas.txt
  1032.  
  1033. t <player_expr> <x> <y> <z>
  1034.  
  1035.     Teleports the player to position (x, y, z).
  1036.    
  1037.     Example:
  1038.  
  1039.         t 3 100.4 -74.2 36
  1040.  
  1041. t <player_expr> <location_name>
  1042.  
  1043.     Teleports the player to a previously added location.
  1044.    
  1045.     Example:
  1046.  
  1047.         t 3 red_base
  1048.  
  1049. m <player_expr> <x> <y> <z>
  1050.  
  1051.     Same usage as t, this command teleports player to location relative to his current position.
  1052.    
  1053.     For example
  1054.  
  1055.         m me 0 0 100 moves admin 100 units up.
  1056.  
  1057. tp <player_expr> <player_number>
  1058.  
  1059.     Teleports given player(s) to another player.
  1060.    
  1061.     For example
  1062.        
  1063.         tp me 5
  1064.             teleports me to player 5
  1065.        
  1066.         tp * 1
  1067.             teleports all players to player 1
  1068.            
  1069.         tp 8 2
  1070.             teleports player 8 to player 2
  1071.  
  1072. boost <player_expr>
  1073.  
  1074.     Teleports the given player to the location where he/she looks.
  1075.  
  1076. hp <player_expr> [amount]
  1077.  
  1078.     Displays / sets the given player(s) health.
  1079.  
  1080. sh <player_expr> [amount]
  1081.  
  1082.     Displays / sets the given player(s) shield.
  1083.  
  1084. nades <player_expr> [amount] [type]
  1085.  
  1086.     Displays / sets the amount of nades of the given players.
  1087.  
  1088.     Type:
  1089.         0/ungiven: both
  1090.         1: frag nades
  1091.         2: plasma nades
  1092.  
  1093. ammo <player_expr> [amount] [type]
  1094.  
  1095.     Displays / sets the amount of the ammo of the given players.
  1096.  
  1097.     Type:
  1098.         0/ungiven: current weapon
  1099.         1: primary
  1100.         2: secondary
  1101.         3 tertiary
  1102.         4: quaternary
  1103.         5: all
  1104.  
  1105. battery <player_expr> [amount] [type]
  1106.  
  1107.     Works the same way as ammo, you can set the battery of the covenant weapons (in %), sync after you switch weapon and switch back. Type is same as above.
  1108.  
  1109. mag <player_expr> [amount] [type]
  1110.  
  1111.     Set the loaded bullets in the given weapon(s), set it to 32000 for "infinitive" bullets. Type is same as above too.
  1112.  
  1113. spawn <type> <name>
  1114.  
  1115.     Ex:
  1116.    
  1117.         spawn weap "weapons\sniper rifle\sniper rifle"
  1118.        
  1119.             will spawn a sniper to you. Scroll down to the bottom of the page for the names of all classic objects.
  1120.  
  1121. spawn <type> <name> [player_number]
  1122.  
  1123.     Will spawn the object to the given player.
  1124.  
  1125. spawn <type> <name> <x> <y> <z> [rot]
  1126.  
  1127.     Will spawn the object to the given coords and rotation (in radians).
  1128.  
  1129. spawn <type> <name> <location_name>
  1130.  
  1131.     Will spawn the object to a previously added location.
  1132.  
  1133. wadd <player_expr>
  1134.  
  1135.     Assign the last spawned weapon to the given player. You can assign up to 4 weapons. Note that if the player has 4 weapons, he/she can't pick up the flag/oddball.
  1136.  
  1137. wdel <player_expr> <weapon_number>
  1138.  
  1139.     Removes the weapon from the player's hand, weapon_number: 0 - all, 1-4 the selected one.
  1140.  
  1141. wdrop <player_expr>
  1142.  
  1143.     Forces the player to drop the current weapon from his/her hands.
  1144.  
  1145. venter <player_expr> [seat]
  1146.  
  1147.     Enters the player to the last spawned vehicle. Note that you can enter a player to more vehicles and/or more seats in one vehicle. =)
  1148.  
  1149. vexit <player_expr>
  1150.  
  1151.     Ejects player from the vehicle(s).
  1152.  
  1153. vdel <player_expr>
  1154.  
  1155.     Deletes the vehicles assigned (with the spawn command) to the given player.
  1156.  
  1157. vdel_all
  1158.  
  1159.     Deletes every vehicle spawned with Sapp.
  1160.  
  1161. disable_object <object_name> [team]
  1162.  
  1163.     It will deny the usage of the given objects. You can get the object names from the bottom of this page.
  1164.  
  1165.     team:
  1166.         0/unset - both
  1167.         1 - only players of the red team
  1168.         2 - only players of the blue team
  1169.  
  1170.     Example: disable shotgun for the blue team
  1171.        
  1172.         disable_object "weapons\shotgun\shotgun" 2
  1173.  
  1174. disabled_objects
  1175.  
  1176.     Displays the disabled objects and their IDs.
  1177.  
  1178. enable_object <ID or object_name>
  1179.  
  1180.     Allows the usage of the given object. You can get the ID from disabled_objects, or just use the same name of the object that's used for disable it.
  1181.  
  1182. disable_all_objects <team> <disable>
  1183.  
  1184.     team:
  1185.         0 - both
  1186.         1 - red
  1187.         2 - blue
  1188.    
  1189.     disable:
  1190.         0 - the team can interact with any object (default)
  1191.         1 - the given team(s) can't interact with any object (weapons, powerups, etc.)
  1192.  
  1193. disable_all_vehicles <team> <disable>
  1194.  
  1195.     team:
  1196.         0 - both
  1197.         1 - red
  1198.         2 - blue
  1199.    
  1200.     disable:
  1201.         0 - the team can interact with any object (default)
  1202.         1 - the given team(s) can't interact with any vehicle
  1203.  
  1204. color <player_expr> [index]
  1205.  
  1206.     Changes the color of the given players (after respawn, and not in team games).
  1207.    
  1208.     Index is a number from 0 to 17, where:
  1209.         0 - white
  1210.         1 - black
  1211.         2 - red
  1212.         3 - blue
  1213.         4 - gray
  1214.         5 - yellow
  1215.         6 - green
  1216.         7 - pink
  1217.         8 - purple
  1218.         9 - cyan
  1219.         10 - cobalt
  1220.         11 - orange
  1221.         12 - teal
  1222.         13 - sage
  1223.         14 - brown
  1224.         15 - tan
  1225.         16 - maroon
  1226.         17 or above - salmon.
  1227.  
  1228. gamespeed [speed]
  1229.  
  1230.     Sets the game speed, which will be synchronized with HAC2 and Anticheat users. Default value is 30.
  1231.  
  1232. --]]
  1233.  
  1234. ---
  1235. DEFAULT OBJECT NAMES
  1236.  
  1237.     Escape the backslash and use single-quotation-mark symbols when using these in a Lua script. For example:
  1238.    
  1239.         execute_command('spawn vehi "vehicles\\banshee\\banshee_mp"')
  1240.    
  1241. ---[[
  1242.    
  1243.     Vehicles:
  1244.  
  1245. Banshee                 vehi "vehicles\banshee\banshee_mp"
  1246.  
  1247. Covenant Gun turret     vehi "vehicles\c gun turret\c gun turret_mp"
  1248.  
  1249. Ghost                   vehi "vehicles\ghost\ghost_mp"
  1250.  
  1251. Rocket Warthog          vehi "vehicles\rwarthog\rwarthog"
  1252.  
  1253. Scorpion                vehi "vehicles\scorpion\scorpion_mp"
  1254.  
  1255. Warthog                 vehi "vehicles\warthog\mp_warthog"
  1256.  
  1257.     Weapons:
  1258.  
  1259. Assault Rifle           weap "weapons\assault rifle\assault rifle"
  1260.  
  1261. Oddball                 weap "weapons\ball\ball"
  1262.  
  1263. Flag                    weap "weapons\flag\flag"
  1264.  
  1265. Flamethrower            weap "weapons\flamethrower\flamethrower"
  1266.  
  1267. Fuel rod gun            weap "weapons\plasma_cannon\plasma_cannon"
  1268.  
  1269. Needler                 weap "weapons\needler\mp_needler"
  1270.  
  1271. Pistol                  weap "weapons\pistol\pistol"
  1272.  
  1273. Plasma Pistol           weap "weapons\plasma pistol\plasma pistol"
  1274.  
  1275. Plasma Rifle            weap "weapons\plasma rifle\plasma rifle"
  1276.  
  1277. Rocket Laucher          weap "weapons\rocket launcher\rocket launcher"
  1278.  
  1279. Shotgun                 weap "weapons\shotgun\shotgun"
  1280.  
  1281. Sniper Rifle            weap "weapons\sniper rifle\sniper rifle"
  1282.  
  1283.     Equipment:
  1284.  
  1285. Frag Grenade            eqip "weapons\frag grenade\frag grenade"
  1286.  
  1287. Plasma Grenade          eqip "weapons\plasma grenade\plasma grenade"
  1288.  
  1289. Healt Pack              eqip "powerups\health pack"
  1290.  
  1291. Over Shield             eqip "powerups\over shield"
  1292.  
  1293. Camouflage              eqip "powerups\active camouflage"
  1294.  
  1295.     Bipeds:
  1296.  
  1297. Spartan                 bipd "characters\cyborg_mp\cyborg_mp"
  1298.  
  1299.  
  1300. --]]
  1301.  
  1302. ---
  1303. CUSTOM COMMANDS
  1304. ---[[
  1305.  
  1306.     You can combine existing commands into custom commands to do more complex operations with one command.
  1307.  
  1308.     Custom commands are stored in the gametypes folder, for example "..\savegames\sapp\commands.txt" in the following format:
  1309.  
  1310. <command name> [arguments] <command sequence> [level]
  1311.  
  1312.     The arguments start with a "#" and they will be replaced in the sequence with the values the command is being called.
  1313.  
  1314.     The commands in the sequence are separated by a ";".
  1315.  
  1316.     If you don't specify required admin level, it will be 4 (highest) by default.
  1317.  
  1318.     Some examples:
  1319.  
  1320.         reset 'sv_map_reset' 3
  1321.  
  1322.         lo3 'sv_map_reset;w8 1;sv_map_reset;w8 1;sv_map_reset' 3
  1323.  
  1324.         max #n 'sv_maxplayers #n' 4
  1325.  
  1326.         spam 'w8 600;say * "Have Fun, \n! Server Powered by SAPP, xhalo.tk";spam'
  1327.  
  1328.         give #weap 'spawn weap "weapons\#weap\#weap" $n;wadd $n'
  1329.  
  1330.         shee 'spawn vehi vehicles\banshee\banshee_mp $n'
  1331.  
  1332.         toshee 'shee;venter $n'
  1333.  
  1334.         shee_army 'toshee;toshee;toshee;toshee;toshee;toshee;toshee;toshee;toshee;toshee'
  1335.  
  1336. cmd_add <command name> [arguments] <command sequence> [level]
  1337.  
  1338.     Creates a new custom command and adds it to the end of the commands.txt
  1339.  
  1340. cmd_del <command name>
  1341.  
  1342.     Deletes the given command, but doesn't modify the commands.txt
  1343.  
  1344. list custom
  1345.  
  1346.     Lists all custom commands.
  1347.  
  1348. --]]
  1349.  
  1350. --]=]
  1351.  
  1352.  
  1353. -- START OF USER CONFIGURATIONS
  1354.  
  1355.  
  1356.  
  1357. -- END OF USER CONFIGURATIONS
  1358.  
  1359. api_version = "1.9.0.0"
  1360. function OnScriptLoad()
  1361.     -- Called when you use the "lua_load" command.
  1362.    
  1363.     --register_callback(cb['EVENT_GAME_START'],"OnStart")
  1364.     --register_callback(cb['EVENT_DAMAGE_APPLICATION'],"OnDamage")
  1365.     --register_callback(cb['EVENT_KILL'],"OnKill")
  1366.     --register_callback(cb['EVENT_BETRAY'],"OnBetray")
  1367.     --register_callback(cb['EVENT_DIE'],"OnDie")
  1368.     --register_callback(cb['EVENT_SUICIDE'],"OnSuicide")
  1369.     --register_callback(cb['EVENT_SCORE'],"OnScore")
  1370.     --register_callback(cb['EVENT_PRESPAWN'],"OnPreSpawn")
  1371.     --register_callback(cb['EVENT_SPAWN'],"OnSpawn")
  1372.     --register_callback(cb['EVENT_ALIVE'],"OnLiving")
  1373.     --register_callback(cb['EVENT_CHAT'],"OnChat")
  1374.     --register_callback(cb['EVENT_PREJOIN'],"OnPreJoin")
  1375.     --register_callback(cb['EVENT_JOIN'],"OnJoin")
  1376.     --register_callback(cb['EVENT_LEAVE'],"OnLeave")
  1377.     --register_callback(cb['EVENT_TEAM_SWITCH'],"OnTeamSwitch")
  1378.     --register_callback(cb['EVENT_VEHICLE_ENTER'],"OnVehicleEnter")
  1379.     --register_callback(cb['EVENT_VEHICLE_EXIT'],"OnVehicleExit")
  1380.     --register_callback(cb['EVENT_AREA_ENTER'],"OnAreaEnter")
  1381.     --register_callback(cb['EVENT_AREA_EXIT'],"OnAreaExit")
  1382.     --register_callback(cb['EVENT_CAMP'],"OnCamp")
  1383.     --register_callback(cb['EVENT_GAME_END'],"OnEnd")
  1384.     --register_callback(cb['EVENT_LOGIN'],"OnLogin")
  1385.     --register_callback(cb['EVENT_COMMAND'],"OnCommand")
  1386.     --register_callback(cb['EVENT_ECHO'],"OnEcho")
  1387.     --register_callback(cb['EVENT_TICK'],"OnTick")
  1388.     --register_callback(cb['EVENT_MAP_RESET'],"OnMapReset")
  1389.     --register_callback(cb['EVENT_OBJECT_SPAWN'],"OnObjectSpawn")
  1390.     --register_callback(cb['EVENT_SNAP'],"OnCameraSnap")
  1391.     --register_callback(cb['EVENT_WARP'],"OnWarp")
  1392.     --register_callback(cb['EVENT_WEAPON_PICKUP'],"OnWeaponPickup")
  1393.     --register_callback(cb['EVENT_WEAPON_DROP'],"OnWeaponDrop")
  1394. end
  1395.  
  1396. function OnScriptUnload()
  1397.     -- Called when you use the "lua_unload" command.
  1398.    
  1399. end
  1400.  
  1401. function OnError(Message)
  1402.     -- Called if a declared error occurs in this Lua script
  1403.     print(debug.traceback())
  1404. end
  1405.  
  1406. function OnLiving(PlayerIndex)
  1407.     -- This event is called every second that a player is alive.
  1408.    
  1409. end
  1410.  
  1411. function OnAreaEnter(PlayerIndex, Area)
  1412.     -- This event is called when a player enters an area.
  1413.    
  1414. end
  1415.  
  1416. function OnAreaExit(PlayerIndex, Area)
  1417.     -- This event is called when a player exits an area.
  1418.    
  1419. end
  1420.  
  1421. function OnBetray(PlayerIndex)
  1422.     -- This event is called when a player has team-killed.
  1423.    
  1424. end
  1425.  
  1426. function OnCamp(PlayerIndex, CampKills)
  1427.     -- This event is called when a player has killed while camping and anticamp is enabled, with CampKills being the number of kills the player has made while camping.
  1428.    
  1429. end
  1430.  
  1431. function OnChat(PlayerIndex, Message)
  1432.     -- This event is called when a chat message is sent.
  1433.    
  1434.     -- Returns: optional boolean Allow
  1435.    
  1436. end
  1437.  
  1438. function OnCommand(PlayerIndex, Command, Environment, RconPassword)
  1439.     -- This event is called when a command has been attempted to be executed, regardless of if the command is valid or not. Environment is 0 if it was the console, 1 if it was executed using rcon (RconPassword will be the rcon password used), 2 if it was executed as a chat command.
  1440.    
  1441.     -- Returns: optional boolean Allow
  1442.    
  1443. end
  1444.  
  1445. function OnDamage(PlayerIndex, Causer, MetaID, Damage, HitString, Backtap)
  1446.     -- This event is called when damage is being applied to a player. PlayerIndex is the index of the player who suffers the damage, Causer is the index of the player who caused the damage, MetaID is the Tag-Index of the damage object, Damage is the amount of damage made, HitString can be "head", "body" or "legs", Backtap is true if the damage was a backtap.
  1447.    
  1448.     -- Returns: optional boolean Allow, optional number NewDamage
  1449.    
  1450. end
  1451.  
  1452. function OnDie(PlayerIndex, KilledIndex)
  1453.     -- This event is called when a player kills another player. KilledIndex is 0 if the player was killed by an object that was not owned by a player (e.g. a vehicle, an AI, etc.). KilledIndex is -1 if the player died, but not to an object (e.g. was killed by the server, changed teams, fell to their death, etc.).
  1454.    
  1455. end
  1456.  
  1457. function OnEcho(PlayerIndex, Message)
  1458.     -- This event is called if execute_command and execute_command_sequence was used when having their Echo parameter set to true, and if any commands resulted in a text response. This is called for every line.
  1459.    
  1460. end
  1461.  
  1462. function OnEnd()
  1463.     -- This event is called when the game has ended and the scores are being shown.
  1464.    
  1465. end
  1466.  
  1467. function OnStart()
  1468.     -- This event is called when the game has started.
  1469.    
  1470. end
  1471.  
  1472. function OnJoin(PlayerIndex)
  1473.     -- This event is called when a player has joined the server.
  1474.    
  1475. end
  1476.  
  1477. function OnKill(PlayerIndex, KilledIndex)
  1478.     -- This event is called when a player kills another player.
  1479.    
  1480. end
  1481.  
  1482. function OnLeave(PlayerIndex)
  1483.     -- This event is called when a player has disconnected from the server.
  1484.    
  1485. end
  1486.  
  1487. function OnLogin(PlayerIndex)
  1488.     -- This event is called when a player has logged as a SAPP admin.
  1489.    
  1490. end
  1491.  
  1492. function OnMapReset()
  1493.     -- This event is called when the sv_map_reset command is executed.
  1494.    
  1495. end
  1496.  
  1497. function OnObjectSpawn(PlayerIndex, MetaID, ParentObjectID, ObjectID)
  1498.     -- This event is called before an object is created. ParentObjectID is 0xFFFFFFFF if the object has no parents :(. The object's meta ID will be overridden with ReplacementMetaID if it is set.
  1499.  
  1500.     -- Returns: optional boolean Allow, optional number ReplacementMetaID
  1501.    
  1502. end
  1503.  
  1504. function OnPreJoin(PlayerIndex)
  1505.     -- This event is called when a player machine has joined the server.
  1506.    
  1507. end
  1508.  
  1509. function OnPreSpawn(PlayerIndex)
  1510.     -- This event is called the moment a player spawns, but before clients are notified, allowing modifications that aren't possible in EVENT_SPAWN.
  1511.    
  1512. end
  1513.  
  1514. function OnScore(PlayerIndex)
  1515.     -- This event is called when a player has scored in CTF.
  1516.    
  1517. end
  1518.  
  1519. function OnCameraSnap(PlayerIndex, AimbotScoreAdded)
  1520.     -- This event is called when a player's camera has moved irregularly and snapped. The player may be suspected of aimbotting.
  1521.    
  1522. end
  1523.  
  1524. function OnSpawn(PlayerIndex)
  1525.     -- This event is called when a player spawns and clients have been notified.
  1526.    
  1527. end
  1528.  
  1529. function OnSuicide(PlayerIndex)
  1530.     -- This event is called when a player has committed suicided.
  1531.    
  1532. end
  1533.  
  1534. function OnTeamSwitch(PlayerIndex)
  1535.     -- This event is called when a player has switched teams.
  1536.    
  1537. end
  1538.  
  1539. function OnTick()
  1540.     -- This event is called every tick (1 tick = 1/30th of a second).
  1541.    
  1542. end
  1543.  
  1544. function OnVehicleEnter(PlayerIndex, Seat)
  1545.     -- This event is called when a player has entered a vehicle. Seat is the index of the seat, starting with 0.
  1546.    
  1547. end
  1548.  
  1549. function OnVehicleExit(PlayerIndex)
  1550.     -- This event is called when a player has exited a vehicle.
  1551.    
  1552. end
  1553.  
  1554. function OnWarp(PlayerIndex)
  1555.     -- This event is called when a player has warped.
  1556.    
  1557. end
  1558.  
  1559. function OnWeaponDrop(PlayerIndex, WeaponSlot)
  1560.     -- This event is called when a player dropped a weapon. WeaponSlot is weapon slots 1 thru 4.
  1561.    
  1562. end
  1563.  
  1564. function OnWeaponPickup(PlayerIndex, WeaponSlot, WeaponType)
  1565.     -- This event is called when a player has picked up a weapon. WeaponType is 1 if it's a standard weapon, or 2 if it's a grenade. If it was a grenade that was picked up, then WeaponSlot is 1 if it was a fragmentation grenade, or 2 if it was a plasma grenade. Otherwise, it's weapon slots 1 thru 4.
  1566.    
  1567. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top