Multiplayer Spades: Hooks

Support versions: 0.9 beta test 15 PREREALISE2 – …

Usage:

Calling hook

hook.call(string hookname, array args);
  1. string hookname
    UID of hook
  2. array args
    Array of arguments for hook

Adding hook

hook.add(string hookname, function callback);
  1. string hookname
    UID of hook
  2. function callback
    Callback when hook called.

Deleting all hooks

hook.del(string hookname);
  1. string hookname
    UID of hook

Examples:

function hook_call(){ // Calling hook function 
  hook.call("my_hook", ['Useful string!', 100, 20.102, "Another one", somevar]); 
}

var somevar = "Hello world!";

hook.add("my_hook", function(args){
  console.log(args[0]); // Useful string!
  console.log(args[1]); // 100
  console.log(args[2]); // 20.102
  console.log(args[3]); // Another one
  console.log(args[4]); // Hello world!
});

hook_call();
hook.del("my_hook");
hook_call(); // Undefined

 

In-game hooks:

Settings hooks:

  • Game settings changes:
    • uopt_chat_opacity_changed – Changing chat-box opacity
      Support versions: 0.9 beta test 15 PREREALISE2 – …

      array [string value]
      • string value
        Value of the sliderbar
    • uopt_hud_changed – Changing hud visibility
      Support versions: 0.9 beta test 15 PREREALISE2 – …

      array [string value]
      • string value
        Index value of the list
    • uopt_obj_rotation_changed – Changing value of object rotation
      Support versions: 0.9 beta test 15 PREREALISE2 – …

      array [string value]
      • string value
        Value of the sliderbar
    • uopt_snap_changed – Changing snap-to-grid option
      Support versions: 0.9 beta test 15 PREREALISE2 – …

      array [string value]
      • string value
        Index value of the list
  • Admin changes:
    • aopt_kick_changed – Kicking a player
      Support versions: 0.9 beta test 15 PREREALISE2 – …

      array [string ply_id, string kick_reason]
      • string ply_id
        Player’s id to kick
      • string kick_reason
        Reason for kicking
    • aopt_map_clear_changed – Clearing map
      Support versions: 0.9 beta test 15 PREREALISE2 – …

      array []
      • empty array
    • aopt_cr_obj_changed – Spawning objects
      Support versions: 0.9 beta test 15 PREREALISE2 – …

      array [string type_val, string count_val]
      • string type_val
        Index value of the list
      • string count_val
        Index value of the list
    • aopt_spawn_time_changed – Changing spawn time for objects
      Support versions: 0.9 beta test 15 PREREALISE2 – …

      array [string value]
      • string value
        Value of input
    • aopt_sv_map_changed – Saving map
      Support versions: 0.9 beta test 15 PREREALISE2 – …

      array [string value]
      • string value
        Value of input
    • aopt_ld_map_changed – Loading map
      Support versions: 0.9 beta test 15 PREREALISE2 – …

      array [string value]
      • string value
        Value of input
    • aopt_gamemode_changed – Changing gamemode
      Support versions: 0.9 beta test 15 PREREALISE2 – …

      array [string value]
      • string value
        Index value of the list
    • aopt_sal_count_changed – Changing salary value
      Support versions: 0.9 beta test 15 PREREALISE2 – …

      array [string salary_val, string time_val]
      • string salary_val
        Input value
      • string time_val
        Input value
    • aopt_build_changed – Changing build permission [admin option]
      Support versions: 0.9 beta test 15 PREREALISE2 – …

      array [string value]
      • string salary_val
        Index value of the list
    • aopt_upg_changed – Changing upgrades permission
      Support versions: 0.9 beta test 15 PREREALISE2 – …

      array [string value]
      • string salary_val
        Index value of the list

Leave a Reply

Your email address will not be published. Required fields are marked *