Bind commands to phone numbers

Supported Games
GameServerKingsGameServerKings

Allows you to bind set of commands to telephone number with support of permissions and cooldowns. Players can use any phone to call those numbers and server will execute commands for them if all conditions are met. Command phone numbers are automatically added to top of public directory and all crafted phones have them in contact list.

DEMO

Permissions

There are no default permissons, but you can assign permission to telephone number. More info in configuration section.

Configuration

{
  "AddCommandsToContactList": true,
  "BlockChatCommandsBoundToPhoneNumber": false,
  "EffectEnabled": true,
  "EffectFailed": "assets/prefabs/npc/scientist/sound/death.prefab",
  "EffectSuccess": "assets/prefabs/npc/scientist/sound/respondok.prefab",
  "PhoneCommands": [
    {
      "Cooldown": 3600,
      "Permission": "phonecommands.vip",
      "RestrictLandlinePhones": false,
      "RestrictMobilePhones": false,
      "RestrictPublicPhones": false,
      "PhoneActions": [
        {
          "Command": "inventory.giveto {0} xmas.present.large 1",
          "Type": "command"
        },
        {
          "Command": "{1} just recieved large gift! Call {6:####-####} to get it too.",
          "Type": "broadcast"
        }
      ],
      "PhoneName": "Hourly gift",
      "PhoneNumber": 12345678
    },
    {
      "Cooldown": 0,
      "Permission": null,
      "RestrictLandlinePhones": false,
      "RestrictMobilePhones": false,
      "RestrictPublicPhones": false,
      "PhoneActions": [
        {
          "Command": "Command executed - player id: {0}, player name: {1}, position x,y,z: {2},{3},{4}, grid coord: {5}, called number: {6:####-####}",
          "Type": "reply"
        }
      ],
      "PhoneName": "Another example",
      "PhoneNumber": 87654321
    }
  ]
}

Global

  • AddCommandsToContactList - true/false - automatically add commands to crafted phone contact list.
  • BlockChatCommandsBoundToPhoneNumber - true/false - allows only phone execution of bound chat commands
  • EffectEnabled - true/false - allow response sound effects
  • EffectFailed - prefab name - response effect to be played when on cooldown or without permission
  • EffectSuccess - prefab name - response effect to be played when all conditions are met

PhoneCommands

  • PhoneName - name to be listed in public directory and contact list, maximum of 19 characters
  • PhoneNumber - 8 digits, no spaces
  • Cooldown - how many seconds player needs to wait before using that number again (cooldown not applied to admins)
  • Permission - specify permission required to use, or set null (permission requirement not applied to admins)
  • RestrictLandlinePhones - prevents using deployed phones to call this number
  • RestrictMobilePhones - prevents using mobile phones to call this number
  • RestrictPublicPhones - prevents using public phone booths to call this number
  • PhoneActions - one or more actions to be executed
    • Command - command string with placeholders (see configuration example)
    • Type - type of command: server for server command, broadcast for message to all player, reply for message to calling player, playerchat for message from calling player (used for chat commands, see below)

Chat commands

  • for chat commands, use playerchat type
  • make sure to add slash / or it will be just player message
  • optionaly set BlockChatCommandsBoundToPhoneNumber to true, so only phone call can execute this command
  • note that chat command's permission, cooldowns and other conditions are handled by its plugin, so PhoneCommands will play success effect every time, unless you add cooldown or permission to this configuration aswell
{
  "Cooldown": 0,
  "Permission": null,
  "PhoneActions": [
    {
      "Command": "/callheli",
      "Type": "playerchat"
    }
  ],
  "PhoneName": "Request heli",
  "PhoneNumber": 79463164
}

Localization

{
  "CommandCooldown": "Cooldown remaining: {0} minutes",
  "PermissionRequired": "Not allowed!",
  "ChatCommandBlocked": "This chat command is disabled. Call {0:#### ####} instead.",
  "DeviceRestricted": "This number cannot be called from your device. Try another."
}

Support

Discord: marcuzz#6608

MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.