Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
example_commandscript.cpp
Go to the documentation of this file.
1/*
2* This file is part of Project SkyFire https://www.projectskyfire.org.
3* See LICENSE.md file for Copyright information
4*/
5
6/* ScriptData
7Name: Example_Commandscript
8%Complete: 100
9Comment: Short custom scripting example
10Category: Script Examples
11EndScriptData */
12
13#include "ScriptMgr.h"
14#include "Chat.h"
15
16// **** This script is designed as an example for others to build on ****
17// **** Please modify whatever you'd like to as this script is only for developement ****
18
19// **** Script Info* ***
20// This script's primary purpose is to show just how much you can really do with commandscripts
21
23{
24 public:
25 example_commandscript() : CommandScript("example_commandscript") { }
26
27 static bool HandleHelloWorldCommand(ChatHandler* handler, const char* /*args*/)
28 {
29 handler->PSendSysMessage("Hello World");
30 return true;
31 }
32
33 std::vector<ChatCommand> GetCommands() const OVERRIDE
34 {
35 static std::vector<ChatCommand> HelloWorldCommandTable =
36 {
37 { "hello", SEC_PLAYER, true, &HandleHelloWorldCommand, "", },
38 };
39 return HelloWorldCommandTable;
40 }
41};
42
#define OVERRIDE
Definition Define.h:60
void PSendSysMessage(const char *format,...) ATTR_PRINTF(2
Definition Chat.cpp:221
CommandScript(const char *name)
static bool HandleHelloWorldCommand(ChatHandler *handler, const char *)
std::vector< ChatCommand > GetCommands() const OVERRIDE
void AddSC_example_commandscript()