Jump to content

Proper use of Pedcollection


Recommended Posts

I've looked through all the tutorials and the search is down:

 

I've created an extensive mod, and i am having trouble with ped collection. I created a bypass that takes my "nolongerneeded" peds and removes them while offscreen as a tick due to the fact i cannot seem to get the Pedcollections to work properly. I could use help if anyone is available.

 

 

Inherits Script   Private Infected As Boolean = False   Private Cop As Boolean = False   Private Invi As Boolean = False   Private Pedcollection As system.object      '**** cannot get to function?????****   Private Const HEALTH_VALUE As Integer = 100Public Sub New()       pedcollection.OrderByDistanceTo(Player.Character.Position, 21.0F)  '****cannot get to function????****       bindkey(keys.M, AddressOf Infected1)       bindkey(keys.H, AddressOf Police)       bindkey(keys.J, AddressOf Invincible)       bindkey(keys.I, AddressOf FireWeapons)

 

 

i've also tried the line "pedcollection.OrderByDistanceTo(Player.Character.Position, 21.0F)" in the block creating the targeted peds that is set up on a toggle. It does, as expected, error when activated. The targeted Peds, on the toggle, are set on a tick.

 

I am using Visual Basic, but any example may help.

Link to comment
https://gtaforums.com/topic/470179-proper-use-of-pedcollection/
Share on other sites

iriedreadlock23

PedCollection is very simple example of System.Collections Namespace, particulary ObjectModel. You can Add, Remove, get IndexOf etc. If you want your own collections of any object (string, integer, vehicle...) use this:

 

 

Imports System.Collections.ObjectModelPrivate Class MyClassPrivate MyPedCollection as Collection(Of Ped)Private Test_Ped as PedSub New()MyPedCollection = New Collection (Of Ped)Test_Ped = World.CreatePed(Player.Character.Position)MyPedCollection.Add ( Test_Ped) End SubSub Hide_Peds()For Each iPed as Ped in MyPedCollectionIf iPed.isOnScreen = False Then iPed.Visible = FalseNext ForEnd SubEnd Class

 

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • 0 User Currently Viewing
    0 members, 0 Anonymous, 0 Guests

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.