Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include a_samp
- #include a_vectors
- public OnFilterScriptInit()
- {
- new tick = GetTickCount(), inaccurate = 0;
- new ID:vecid = Vector_Create(Vector::Float);
- Vector_Push(Vector::Float, vecid, .v2 = 55.6); // push data to float vector id 0
- Vector_Push(Vector::Float, vecid, .v2 = 20.6); // push data to float vector id 0
- Vector_Push(Vector::Float, vecid, .v2 = 4.2); // push data to float vector id 0
- Vector_Push(Vector::Float, vecid, .v2 = 9.2); // push data to float vector id 0
- new len = Vector_GetSize(Vector::Float, vecid); // get count of datas exist in float vector id 0
- new printtook = GetTickCount();
- printf("Length: %d",len);
- inaccurate += GetTickCount() - printtook;
- for(new i = 0; i < len; i++)
- {
- printtook = GetTickCount();
- printf("%f",Vector_GetValue(Vector::Float, vecid, i));
- inaccurate += GetTickCount() - printtook;
- }
- printtook = GetTickCount();
- printf("Now trying to create vectors");
- inaccurate += GetTickCount() - printtook;
- new
- ID:vec1 = Vector_Create(Vector::Float),
- ID:vec2 = Vector_Create(Vector::Float);
- printtook = GetTickCount();
- printf("%d %d %d", _:vec1, _:vec2, _:Vector_Create(Vector::Int));
- printf("Removing floats vectors in slot 2 and 0");
- inaccurate += GetTickCount() - printtook;
- Vector_Clear(Vector::Float, ID:2);
- Vector_Clear(Vector::Float, ID:0);
- vec1 = Vector_Create(Vector::Float);
- vec2 = Vector_Create(Vector::Float);
- printtook = GetTickCount();
- printf("Remaking two float vectors: %d %d", _:vec1, _:vec2);
- inaccurate += GetTickCount() - printtook;
- Vector_Push(Vector::Int, ID:0, .v2 = 15);
- Vector_Push(Vector::Int, ID:0, .v2 = 6);
- Vector_Push(Vector::Int, ID:0, .v2 = 9);
- Vector_Push(Vector::Int, ID:0, .v2 = 20);
- Vector_Push(Vector::Int, ID:0, .v2 = 23);
- Vector_Push(Vector::Int, ID:0, .v2 = 4);
- Vector_Push(Vector::Int, ID:0, .v2 = 18);
- Vector_Sort(Vector::Int, ID:0);
- len = Vector_GetSize(Vector::Int, ID:0);
- printtook = GetTickCount();
- print("Testing Vector sort for int\n");
- inaccurate += GetTickCount() - printtook;
- for(new i = 0; i < len; i++)
- {
- printtook = GetTickCount();
- printf("%d",Vector_GetValue(Vector::Int, ID:0, i));
- inaccurate += GetTickCount() - printtook;
- }
- printtook = GetTickCount();
- print("Testing Vector sort for string\n");
- inaccurate += GetTickCount() - printtook;
- Vector_Create(Vector::String);
- Vector_Push(Vector::String, ID:0, "Kalcor");
- Vector_Push(Vector::String, ID:0, "kalcor");
- Vector_Push(Vector::String, ID:0, "Amir");
- Vector_Push(Vector::String, ID:0, "Kurtana");
- Vector_Push(Vector::String, ID:0, "iLearner");
- Vector_Push(Vector::String, ID:0, "ILearner");
- Vector_Push(Vector::String, ID:0, "Jlalt");
- Vector_Push(Vector::String, ID:0, "Freaksken");
- Vector_Sort(Vector::String, ID:0);
- len = Vector_GetSize(Vector::String, ID:0);
- for(new i = 0; i < len; i++)
- {
- new name[32];
- Vector_GetValue(Vector::String, ID:0, i, name);
- printtook = GetTickCount();
- printf("%s",name);
- inaccurate += GetTickCount() - printtook;
- }
- printf("Took %dms in total!",(GetTickCount() - inaccurate) - tick);
- /*
- Output:
- Length: 4
- 55.599998
- 20.600000
- 4.199999
- 9.199999
- Now trying to create vectors
- 1 2 0
- Removing floats vectors in slot 2 and 0
- Remaking two float vectors: 0 2
- Testing Vector sort for int
- 4
- 6
- 9
- 15
- 18
- 20
- 23
- Testing Vector sort for string
- Amir
- Freaksken
- ILearner
- Jlalt
- Kalcor
- Kurtana
- iLearner
- kalcor
- Took 0ms in total!
- */
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement