View Issue Details

IDProjectCategoryView StatusLast Update
0000745GT-MP ServerAPIpublic2018-01-07 12:08
ReporterLe ShredAssigned Toroot 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version 
Target VersionFixed in Version0.1.7 
Summary0000745: Impossible to use Vehicle as key of Dictionary and List
DescriptionIf you set a Vehicle as key of a Disctionary, Dictionary.ContainsKey(Vehicle) will always return false.
Same behavior with List.Contains(Vehicle)
Steps To ReproduceSimply create a vehicle, go indide and launch /testvehicle command

        [Command("testvehicle")]
        public void TestVehiclesCommand(Client sender)
        {
            List<Vehicle> list = new List<Vehicle>();
            Dictionary<Vehicle, object> dictionary = new Dictionary<Vehicle, object>();
            list.Add(sender.vehicle);
            dictionary.Add(sender.vehicle, null);
            API.sleep(100);
            bool result = list.Contains(sender.vehicle);
            sender.sendChatMessage("List contains vehicle: " + result);
            result = dictionary.ContainsKey(sender.vehicle);
            sender.sendChatMessage("Dictionary contains vehicle: " + result);
        }
TagsNo tags attached.

Activities

root

2017-11-05 17:20

developer   ~0001031

Fixed in the next update.
For now use the nethandle (vehicle.handle) as a dictonary key or list index, that should work

Issue History

Date Modified Username Field Change
2017-11-04 09:53 Le Shred New Issue
2017-11-05 17:20 root Assigned To => root
2017-11-05 17:20 root Status new => resolved
2017-11-05 17:20 root Resolution open => fixed
2017-11-05 17:20 root Fixed in Version => 0.1.6
2017-11-05 17:20 root Note Added: 0001031
2018-01-07 12:08 DurtyFree Fixed in Version 0.1.6 => 0.1.7