Advertisement
fakuivan

Untitled

Jan 30th, 2017
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.06 KB | None | 0 0
  1. #include <sourcemod>
  2.  
  3. #pragma semicolon 1
  4. #pragma newdecls required
  5.  
  6. public Plugin myinfo = {
  7.     name        = "",
  8.     author      = "",
  9.     description = "",
  10.     version     = "0.0.0",
  11.     url         = ""
  12. };
  13.  
  14. methodmap NumberList < ArrayList {
  15.     public NumberList(const int[] i_numbers, int i_nof_numbers)
  16.     {
  17.         ArrayList h_this = CreateArray();
  18.         for (int i_index = 0; i_index < i_nof_numbers; i_index++)
  19.         {
  20.             PushArrayCell(h_this, i_numbers[i_index]);
  21.         }
  22.         return view_as<NumberList>(h_this);
  23.     }
  24.    
  25.     property int m_iFirst
  26.     {
  27.         public get() { return GetArrayCell(this, 0); }
  28.     }
  29. }
  30.  
  31. methodmap NumberListModifiable < NumberList {
  32.     public NumberListModifiable(NumberList h_existing)
  33.     {
  34.         return view_as<NumberListModifiable>(h_existing);
  35.     }
  36.    
  37.     property int m_iFirst
  38.     {
  39.         public set(int i_first) { SetArrayCell(this, 0, i_first); }
  40.     }
  41. }
  42.  
  43. public void OnPluginStart()
  44. {
  45.     NumberList h_base_numbers = new NumberList({1, 2, 3}, 3);
  46.     NumberListModifiable h_numbers = new NumberListModifiable(h_base_numbers);
  47.     h_numbers.m_iFirst = h_numbers.m_iFirst + 1;
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement