Detecting if player is using Phone?

I noticed there is no hook (atleast from what I could tell) about detecting if a player is using a phone. I was assuming this might be client side, but then I realized it shows other people that the phone is being used, so it must sent that info to the server somehow.

Does anyone know how I might be ablet to detect this? Like is there a way for me to detect when the phone model changes (from the phone sitting ontop to being in the players hands).

Also to be clear, what I mean by "player using" is that they interacted with the phone and are looking at the GUI (not dialing or answering because there are already hooks for those).

No, sadly there's no hooks for the Phone exactly, though the Telephone is Container. I haven't tested, but you could possibly hook into CanLootEntity and test if that entity is a Telephone. Let me know if that worked or not.

There are quiet a few phone hooks actually. 

  • bool CanRecieveCall(PhoneController phone)
  • object OnPhoneAnswer(PhoneController phone, BasePlayer receiver)
  • void OnPhoneAnswered(PhoneController phone, BasePlayer receiver)
  • object OnPhoneCallStart(PhoneController phone, PhoneController otherPhone, BasePlayer player)
  • void OnPhoneCallStarted(PhoneController phone, PhoneController otherPhone, BasePlayer player)
  • object OnPhoneDial(PhoneController phone, PhoneController otherPhone, BasePlayer player)
  • object OnPhoneDialFail(PhoneController phone, Telephone.DialFailReason reason, BasePlayer player)
  • void OnPhoneDialFailed(PhoneController phone, Telephone.DialFailReason reason, BasePlayer player)
  • object OnPhoneDialTimeout(PhoneController callerPhone, PhoneController receiverPhone, BasePlayer callerPlayer)
  • void OnPhoneDialTimedOut(PhoneController callerPhone, PhoneController receiverPhone, BasePlayer callerPlayer)
LegitSoulja

No, sadly there's no hooks for the Phone exactly, though the Telephone is Container. I haven't tested, but you could possibly hook into CanLootEntity and test if that entity is a Telephone. Let me know if that worked or not.

I just tested CanLootEntity (including every overload), sadly it does not seem to trigger that hook. Though with your shared knowledge that the Telephone is a container, perhaps there is something to work with there if we did enough.

 

uHLeUAFAjcpnPMo.jpg Wulf

There are quiet a few phone hooks actually. 

  • bool CanRecieveCall(PhoneController phone)
  • object OnPhoneAnswer(PhoneController phone, BasePlayer receiver)
  • void OnPhoneAnswered(PhoneController phone, BasePlayer receiver)
  • object OnPhoneCallStart(PhoneController phone, PhoneController otherPhone, BasePlayer player)
  • void OnPhoneCallStarted(PhoneController phone, PhoneController otherPhone, BasePlayer player)
  • object OnPhoneDial(PhoneController phone, PhoneController otherPhone, BasePlayer player)
  • object OnPhoneDialFail(PhoneController phone, Telephone.DialFailReason reason, BasePlayer player)
  • void OnPhoneDialFailed(PhoneController phone, Telephone.DialFailReason reason, BasePlayer player)
  • object OnPhoneDialTimeout(PhoneController callerPhone, PhoneController receiverPhone, BasePlayer callerPlayer)
  • void OnPhoneDialTimedOut(PhoneController callerPhone, PhoneController receiverPhone, BasePlayer callerPlayer)

I am aware of the phone hooks, unfortunately there doesn not seem to be one for a player simply interacting with the phone (not making or answering a call). Which is what I am looking for at the moment.