Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using GTA;
- namespace GTAModCSHARP {
- class MiLista<T> : List<AutoBomba> {
- public int Find(AutoBomba ab) {
- for (int n = 0; n < this.Count; n++) {
- if (this.ElementAt<AutoBomba>(n).getAuto().GetHashCode() == ab.getAuto().GetHashCode()) {
- return n;
- }
- }
- return -1;
- }
- public int Find(Vehicle v) {
- for (int n = 0; n < this.Count; n++) {
- if (this.ElementAt<AutoBomba>(n).getAuto().GetHashCode() == v.GetHashCode()) {
- return n;
- }
- }
- return -1;
- }
- public bool Contains(Vehicle v) {
- foreach (AutoBomba abomb in this) {
- if (abomb.getAuto().GetHashCode() == v.GetHashCode()) {
- return true;
- }
- }
- return false;
- }
- public AutoBomba get(Vehicle v) {
- if (this.Contains(v)) {
- return this.ElementAt<AutoBomba>(this.Find(v));
- } else {
- return null;
- }
- }
- public void Remove(Vehicle v) {
- if (this.Contains(v)) {
- int pos = this.Find(v);
- this.RemoveAt(pos);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment