Example #1
0
 /**
  ** Register
  ** Registers a new sequence of keys.
  ** The parameters are:
  ** - sequence: The key sequence in an array
  ** - object:   The object instance to be called when the trigger happens
  ** - function: The function to call "
  **/
 public static function Register($ksequence, $object, $function)
 {
     /* Find if this sequence already exists */
     $id = -1;
     foreach (Keybinds::$actions as $action) {
         if ($action->sequence == $ksequence) {
             $id = $action->id;
             break;
         }
     }
     if ($id == -1) {
         $id = Keybinds::MakeID();
         sampkeys_addseq($id, $ksequence);
     }
     $action = new KeybindAction($id, $ksequence, $object, $function);
     $action->next = Keybinds::$actions[$id];
     Keybinds::$actions[$id] = $action;
 }