McPhone | Advanced Phone System

List of functions hooks and usefull information for developers

Hook List

Here you can find list of hooks and Information about them. More general information about hook usage you can find here.

 


McPhone.Hook.CallStart

  Server McPhone.Hook.CallStart( Player caller, Player receiver )

Description

Called when player (caller) starts calling a player (receiver)

Arguments

  1. Player caller | Player, who started the call
  2. Player receiver | Player, who received the call

 

 


McPhone.Hook.UnsuccessCall

  Server McPhone.Hook.UnsuccessCall( Player caller, string number )

Description

Called when player (caller) starts unsuccessful phone call

Arguments

  1. Player caller | Player, who started the call
  2. string numbe | Number, which player tried to reach

 

 


McPhone.Hook.ExtraNumberCalled

  Server McPhone.Hook.ExtraNumberCalled( Player caller, table number )

Description

Called when player (caller) calls scripted phone number

Arguments

  1. Player caller | Player, who started the call
  2. table number | ExtraNumber data

 

 


McPhone.Hook.OnCallEnd

  Server McPhone.Hook.CallStoped( Player ply1, Player ply2 )

Description

Called when player (ply1) interrupts phone call with another player (ply2)

Arguments

  1. Player ply1 | Player, who stopped the call
  2. Player ply2 | Player, who was on call

 

 


McPhone.Hook.Accept

  Server McPhone.Hook.Accept( Player receiver, Player caller )

Description

Called when player (receiver) accept call from player (caller)

Arguments

  1. Player receiver | Player, who accepted the call
  2. Player caller | Player, who calle

 

 


McPhone.Hook.SendSMS

  Server McPhone.Hook.SendSMS( Player sender, Player receiver, string message )

Description

Called when player (sender) sent an sms message to player (receiver)

Arguments

  1. Player receiver | Player, who sent the sms
  2. Player caller | Player, who received the sms
  3. string message | Message text

 

 


McPhone.Hook.SendMail

  Server McPhone.Hook.SendMail( Player sender,  string topic, string message )

Description

Called when player (sender) sends an email

Arguments

  1. Player sender | Player, who sent the email
  2. string topic | Email topic
  3. string message | Message text

 

 


McPhone.Hook.OnPhoneDropped

  Server McPhone.Hook.OnPhoneDropped( Player ply, Entity phone )

Description

Called when player drops his phone

Arguments

  1. Player ply | Player, who dropped his phone
  2. Entity phone | Phone entity, that was created

 

 


McPhone.Hook.OnPhonePicked

  Server McPhone.Hook.OnPhonePicked( Player ply, Entity phone )

Description

Called when player picked up a phone entity

Arguments

  1. Player ply | Player, who picked up the phone entity
  2. Entity phone | Phone entity, that was picked up

 

 


McPhone.Hook.BlockPhone

 Shared McPhone.Hook.BlockPhone( Player ply )

Description

Server side | Called before player starts any phone call

Client side | Called every frame. Automatically closes phone, if hook returns true

Arguments

  1. Player ply | Player, who wants to use a phone

Returns

  1. boolean | block phone from usage by a player

 

 

ExtraNumber Data

Description

Used to create a scriptable phone number


Parameters

delay [number]

Length of call in seconds. Also a delay before running linked function.

icon [table] or [string]

Sets icon to be used inside contact list. You can set string, containing path to the materia directly, without using table, if you don't need icon to ignore button highlight.

Table parameters - [string path to the material, boolean ignore icon highlight]

giphy.gif

nicename [string]

Name to display inside contact list

addtocontacts [boolean]

Add this number to contact list or not. If set to false, this number can be called only manually and can't be saved by player inside the contact list.

sound [table]

Sound to play when number called.

Table parameters - [string path to the sound or url, boolean use url playback instead of local assets]

func [string]

Index to find function inside ExtraNumbersFunc table. This function automatically runs on call end. If call was interrupted by player this function will be ignored. If this function returns true value, phone will be closed on call end. Function calls client side.

delay_func [string]

Index to find function inside ExtraNumbersFunc table. This function automatically runs on call start. If this function returns true value, number will be unavailable. Function calls server side with Player caller argument.

Scripted phone numbers

This page is under development!

 

For now you can see some examples of scripted numbers inside lua\mc_phone\sh_init.lua file. Also this page can help you too.