Hi, i'm trying to make an admin system to get all phones numbers of a player but how can i get the phone number of a phone ? i have tried "GetActiveItem" and i have checked flags , uid , tag but nothing so can we get the phone number ?
Plugin Creation | Phone Number
because i have tried "TelephoneManager.GetPhoneDirectory" but it doesn't work the "PhoneDirectory" is empty so why ? Because i have tried to "Decompile And Recompile" the "AssemblyCSharp.dll" (ServerSide) and change the function in the "TelephoneManager" and it work perfectly but it's mandatory to do this ? because it's not legal.
If you looked at TelephoneManager there is a method PrintAllPhones
yeah i saw but this Functions "PrintAllPhones" need a "ConsoleArg" so i have tried with a new ConsoleArg.Arg and i have selected Server but it doesn't work.
ConsoleSystem.Arg con_arg = new ConsoleSystem.Arg(ConsoleSystem.Option.Server, "");
TelephoneManager.PrintAllPhones(con_arg);
// This Doesn't Work.Merged post
And can we get the "PhoneController" with the Phone Item ?
Merged post
Edit : I have solved the problem alone and i will explain you how. First i have decompiled the game to check how the PhoneController, MobilePhone, Telephone, TelephoneManager etc are managed. So the "Mobile Phone" is an item and the "PhoneController" is an entity. So we need a link between and this is called "HeldEntity" it's not same with
global::MobileInventoryEntity associatedEntity = global::ItemModAssociatedEntity<global::MobileInventoryEntity>.GetAssociatedEntity(this.GetItem(), true);So before explaination in the game you have a "MobilePhone" class and this is not an item but it's an Entity children of "HeldEntity". But you can't create a new instance.
So when you have the HeldEntity i have tried to check which type it is and for me it's a "BaseEntity" but when i have print the type this return to me "MobilePhone" and not "BaseEntity" so you need only to convert this BaseEntity To MobilePhone in the code and you can get a "MobilePhone" class linked to the "MobilePhone" item and after in the "MobilePhone" class you can get the phone controller and print the phone number. Code Below
Item mobile_phone_item = plr_check.GetActiveItem();
MobilePhone mobile_phone_entity = (MobilePhone) mobile_phone_item.GetHeldEntity();
Puts(mobile_phone_entity.Controller.PhoneNumber.ToString());