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
McPhone.Hook.UnsuccessCall
Server McPhone.Hook.UnsuccessCall( Player caller, string number ) |
Description
Called when player (caller) starts unsuccessful phone call
Arguments
McPhone.Hook.ExtraNumberCalled
Server McPhone.Hook.ExtraNumberCalled( Player caller, table number ) |
Description
Called when player (caller) calls scripted phone number
Arguments
- Player caller | Player, who started the call
- 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
McPhone.Hook.Accept
Server McPhone.Hook.Accept( Player receiver, Player caller ) |
Description
Called when player (receiver) accept call from player (caller)
Arguments
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
- Player receiver | Player, who sent the sms
- Player caller | Player, who received the sms
- 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
McPhone.Hook.OnPhoneDropped
Server McPhone.Hook.OnPhoneDropped( Player ply, Entity phone ) |
Description
Called when player drops his phone
Arguments
McPhone.Hook.OnPhonePicked
Server McPhone.Hook.OnPhonePicked( Player ply, Entity phone ) |
Description
Called when player picked up a phone entity
Arguments
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
- Player ply | Player, who wants to use a phone
Returns
- 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]
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.