Advertisement
jlalt

wewa

Jun 21st, 2017
638
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 3.60 KB | None | 0 0
  1. #include a_samp
  2. #include a_vectors
  3.  
  4. public OnFilterScriptInit()
  5. {
  6.     new tick = GetTickCount(), inaccurate = 0;
  7.     new ID:vecid = Vector_Create(Vector::Float);
  8.     Vector_Push(Vector::Float, vecid, .v2 = 55.6); // push data to float vector id 0
  9.     Vector_Push(Vector::Float, vecid, .v2 = 20.6); // push data to float vector id 0
  10.     Vector_Push(Vector::Float, vecid, .v2 = 4.2); // push data to float vector id 0
  11.     Vector_Push(Vector::Float, vecid, .v2 = 9.2); // push data to float vector id 0
  12.     new len = Vector_GetSize(Vector::Float, vecid); // get count of datas exist in float vector id 0
  13.     new printtook = GetTickCount();
  14.     printf("Length: %d",len);
  15.     inaccurate += GetTickCount() - printtook;
  16.     for(new i = 0; i < len; i++)
  17.     {
  18.         printtook = GetTickCount();
  19.         printf("%f",Vector_GetValue(Vector::Float, vecid, i));
  20.         inaccurate += GetTickCount() - printtook;
  21.     }
  22.     printtook = GetTickCount();
  23.     printf("Now trying to create vectors");
  24.     inaccurate += GetTickCount() - printtook;
  25.     new
  26.     ID:vec1 = Vector_Create(Vector::Float),
  27.     ID:vec2 = Vector_Create(Vector::Float);
  28.     printtook = GetTickCount();
  29.     printf("%d %d %d", _:vec1, _:vec2, _:Vector_Create(Vector::Int));
  30.     printf("Removing floats vectors in slot 2 and 0");
  31.     inaccurate += GetTickCount() - printtook;
  32.     Vector_Clear(Vector::Float, ID:2);
  33.     Vector_Clear(Vector::Float, ID:0);
  34.     vec1 = Vector_Create(Vector::Float);
  35.     vec2 = Vector_Create(Vector::Float);
  36.     printtook = GetTickCount();
  37.     printf("Remaking two float vectors: %d %d", _:vec1, _:vec2);
  38.     inaccurate += GetTickCount() - printtook;
  39.     Vector_Push(Vector::Int, ID:0, .v2 = 15);
  40.     Vector_Push(Vector::Int, ID:0, .v2 = 6);
  41.     Vector_Push(Vector::Int, ID:0, .v2 = 9);
  42.     Vector_Push(Vector::Int, ID:0, .v2 = 20);
  43.     Vector_Push(Vector::Int, ID:0, .v2 = 23);
  44.     Vector_Push(Vector::Int, ID:0, .v2 = 4);
  45.     Vector_Push(Vector::Int, ID:0, .v2 = 18);
  46.     Vector_Sort(Vector::Int, ID:0);
  47.     len = Vector_GetSize(Vector::Int, ID:0);
  48.     printtook = GetTickCount();
  49.     print("Testing Vector sort for int\n");
  50.     inaccurate += GetTickCount() - printtook;
  51.     for(new i = 0; i < len; i++)
  52.     {
  53.         printtook = GetTickCount();
  54.         printf("%d",Vector_GetValue(Vector::Int, ID:0, i));
  55.         inaccurate += GetTickCount() - printtook;
  56.     }
  57.     printtook = GetTickCount();
  58.     print("Testing Vector sort for string\n");
  59.     inaccurate += GetTickCount() - printtook;
  60.     Vector_Create(Vector::String);
  61.     Vector_Push(Vector::String, ID:0, "Kalcor");
  62.     Vector_Push(Vector::String, ID:0, "kalcor");
  63.     Vector_Push(Vector::String, ID:0, "Amir");
  64.     Vector_Push(Vector::String, ID:0, "Kurtana");
  65.     Vector_Push(Vector::String, ID:0, "iLearner");
  66.     Vector_Push(Vector::String, ID:0, "ILearner");
  67.     Vector_Push(Vector::String, ID:0, "Jlalt");
  68.     Vector_Push(Vector::String, ID:0, "Freaksken");
  69.     Vector_Sort(Vector::String, ID:0);
  70.     len = Vector_GetSize(Vector::String, ID:0);
  71.     for(new i = 0; i < len; i++)
  72.     {
  73.         new name[32];
  74.         Vector_GetValue(Vector::String, ID:0, i, name);
  75.         printtook = GetTickCount();
  76.         printf("%s",name);
  77.         inaccurate += GetTickCount() - printtook;
  78.     }
  79.     printf("Took %dms in total!",(GetTickCount() - inaccurate) - tick);
  80.     /*
  81.     Output:
  82.     Length: 4
  83.     55.599998
  84.     20.600000
  85.     4.199999
  86.     9.199999
  87.     Now trying to create vectors
  88.     1 2 0
  89.     Removing floats vectors in slot 2 and 0
  90.     Remaking two float vectors: 0 2
  91.     Testing Vector sort for int
  92.  
  93.     4
  94.     6
  95.     9
  96.     15
  97.     18
  98.     20
  99.     23
  100.     Testing Vector sort for string
  101.  
  102.     Amir
  103.     Freaksken
  104.     ILearner
  105.     Jlalt
  106.     Kalcor
  107.     Kurtana
  108.     iLearner
  109.     kalcor
  110.     Took 0ms in total!
  111.     */
  112. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement