Git Product home page Git Product logo

playersay's Introduction

PlayerSay Module

Introduction

PlayerSay is a scaleform module for dota 2 custom games which allows for processing chat statements by clients through the server. It also allows for you to deny/enable team chat AND/OR all chat to individual players dynamically throughout your game. PlayerSay is SCALEFORM, which means at some point in the near future it will no longer work. If you base your game round amount chat commands as a necessity, you are putting yourself at risk.

Installation

  • Download this git repository.
  • Install PlayerSay.swf to your game/dota_addons/ADDON/resource/flash3 folder
  • Merge the custom_ui.txt file from this repo with your own in game/dota_addons/ADDON/resource/flash3 so that the resulting custom_ui.txt file contains a block for "PlayerSay". If you do not have a version of this file you can use the provided file by itself.
  • Merge the custom_events.txt file from this repo with your own in game/dota_addons/ADDON/scripts so that the resulting custom_events.txt file contains a block for "player_say_config". If you do not have a version of this file you can use the provided file by itself.
  • Add playersay.lua to your game/dota_addons/ADDON/scripts/vscripts directory (or some subdirectory) and make sure that you add require('playersay') to your addon_game_mode.lua or similar file.

Usage

In order to listen for player chat, you need to register a handler function for Team chat, and another for All chat:

PlayerSay:TeamChatHandler(function(playerEntity, text)
  print(playerEntity:GetPlayerID() .. " said '" .. text .. '" to their team.')
end)

PlayerSay:AllChatHandler(function(playerEntity, text)
  print(playerEntity:GetPlayerID() .. " said '" .. text .. '" to all chat.')
end)

You can use these handlers to parse the given text, or do whatever you like with it.

By default, all clients are allowed to send chat messages on both Team/Ally chat and All chat. To adjust this at any point in the game, call:

PlayerSay:SendConfig(playerID, allowTeamChatBoolean, allowAllChatBoolean)

e.g.

PlayerSay:SendConfig(0, false, false)

will prevent the player with ID 0 from sending any messages to both Team/Ally chat and All chat. To turn back on all chat only, you could call:

PlayerSay:SendConfig(0, false, true)

Additionally, you can change the configuration of all clients at once using the following command:

PlayerSay:SendConfigToAll(false, false)

SendConfig and SendConfigToAll only disable the normal team/all chat behavior of sending messages to other players, but you can still work with the messages sent to the serve in the TeamChatHandler and AllChatHandler functions.

playersay's People

Contributors

bmddota avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

mrloick

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.