Hallo, erneut darf ich euch eine neue Include vorstellen
Überblick
Die Include gibt euch die Möglichkeit Arrays zu erstellen mit der ihr die Größe mithilfe einiger Funktionen ändern könnt.
Funktionen
* ArrayList:NewArrayList<TYPE>(capacity)
* ArrayList::Destroy (ArrayList:ArrayListID);
* ArrayList::IsValid (ArrayList:ArrayListID);
* ArrayList::Add (ArrayList:ArrayListID, value);
* ArrayList::Remove (ArrayList:ArrayListID, index);
* ArrayList::Size (ArrayList:ArrayListID);
* ArrayList::Capacity (ArrayList:ArrayListID);
* ArrayList::Get (ArrayList:ArrayListID, index);
* ArrayList::EnsureCapacity (ArrayList:ArrayListID, newcapacity);
* ArrayList::Clear (ArrayList:ArrayListID);
* ArrayList::IndexOf (ArrayList:ArrayListID, value);
Alles anzeigen
Beispiele
FilterScript Beispiel
Inventar System Beispiel
ArrayList:NewArrayList<TYPE>(capacity);
@ <TYPE> - Is type of ArrayList, it can be FLOAT or INTEGER
@ (capacity) - Changeable capacity on array
Beispiel:
new ArrayList:myList = NewArrayList<INTEGER>(5);
ArrayList:: Destroy (ArrayList:ArrayListID);
@ ArrayList:ArrayListID - ID / Address of ArrayList which we want destroy
Beispiel:
new ArrayList:myList = NewArrayList<INTEGER>(5);
ArrayList::Destroy(myList);
ArrayList::IsValid(ArrayList:ArrayListID);
@ ArrayList:ArrayListID - ID / Address of ArrayList which we want check
Beispiel:
ArrayList::Add (ArrayList:ArrayListID, value);
@ ArrayList:ArrayListID - ID / Address of ArrayList
@ value - Value which we want add into list
Beispiel:
new ArrayList:myList = NewArrayList<INTEGER>(5);
ArrayList::Add (myList, 45641234);
new ArrayList:floatList = NewArrayList<FLOAT>(2);
ArrayList::Add (floatList, 55.0564495);
ArrayList::Remove(ArrayList:ArrayListID, index);
@ ArrayList:ArrayListID - ID / Address of ArrayList
@ index - Index in list
Beispiel:
new ArrayList:myList = NewArrayList<INTEGER>(5);
ArrayList::Add (myList, 45641234);
ArrayList::Add (myList, 123);
ArrayList::Add (myList, 687654);
ArrayList::Remove (myList, 1); //123
// this is better and safely
ArrayList::Remove (myList, ArrayList::IndexOf (myList, 123); // This will remove index where is value '123'
ArrayList::Size(ArrayList:ArrayListID);
@ ArrayList:ArrayListID - ID / Address of ArrayList
Beispiel:
new ArrayList:myList = NewArrayList<INTEGER>(5);
ArrayList::Add (myList, 45641234);
ArrayList::Add (myList, 123);
ArrayList::Add (myList, 687654);
new size = ArrayList::Size (myList);
print (size); // This will print 3
ArrayList::Capacity(ArrayList:ArrayListID);
@ ArrayList:ArrayListID - ID / Address of ArrayList
Beispiel:
new ArrayList:myList = NewArrayList<INTEGER>(5);
ArrayList::Add (myList, 45641234);
ArrayList::Add (myList, 123);
ArrayList::Add (myList, 687654);
new capacity = ArrayList::Capacity(myList);
print (capacity); // This will print 5
ArrayList::Get (ArrayList:ArrayListID, index);
@ ArrayList:ArrayListID - ID / Address of ArrayList
@ index - Return value from index
Beispiel:
new ArrayList:myList = NewArrayList<INTEGER>(5);
ArrayList::Add (myList, 45641234);
ArrayList::Add (myList, 123);
ArrayList::Add (myList, 687654);
new index2 = ArrayList::Get (myList, 2);
print (index2); // This will print 687654
ArrayList::EnsureCapacity (ArrayList:ArrayListID, newcapacity);
@ ArrayList:ArrayListID - ID / Address of ArrayList
@ newcapacity - New capacity value
Beispiel:
new ArrayList:myList = NewArrayList<INTEGER>(5); // Capacity now is 5
ArrayList::Add (myList, 45641234);
ArrayList::Add (myList, 123);
ArrayList::Add (myList, 687654);
ArrayList::EnsureCapacity (myList, 15); // Now capacity of myList is 15
ArrayList::Clear(ArrayList:ArrayListID);
@ ArrayList:ArrayListID - ID / Address of ArrayList
Beispiel:
new ArrayList:myList = NewArrayList<INTEGER>(5); // Capacity now is 5
ArrayList::Add (myList, 45641234);
ArrayList::Add (myList, 123);
ArrayList::Add (myList, 687654);
// This will clear all values in this list
ArrayList::Clear(myList);
ArrayList::IndexOf (ArrayList:ArrayListID, value);
@ ArrayList:ArrayListID - ID / Address of ArrayList
@ value - Value from which we want get index
Beispiel:
new ArrayList:myList = NewArrayList<INTEGER>(5);
ArrayList::Add (myList, 45641234); // index 0
ArrayList::Add (myList, 123); // index 1
ArrayList::Add (myList, 687654); //index 2 - we want this
new index = ArrayList::IndexOf (myList, 687654); // now index variable is 2
Updates
-
Bugs
-
Download
https://github.com/Ino42O/PawnArrayList
Credits
Ino - Author
Original Topic: http://forum.sa-mp.com/showthread.php?p=3710329#post3710329
PS: Ich bin nicht der Author dieser Include, ich wurde nur darum gebeten diese hier zu teilen !