Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Toggle main menu visibility
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
7
Name: Example_Commandscript
8
%Complete: 100
9
Comment: Short custom scripting example
10
Category: Script Examples
11
EndScriptData */
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
22
class
example_commandscript
:
public
CommandScript
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
43
void
AddSC_example_commandscript
()
44
{
45
new
example_commandscript
();
46
}
Chat.h
AccountTypes::SEC_PLAYER
@ SEC_PLAYER
Definition
Common.h:130
OVERRIDE
#define OVERRIDE
Definition
Define.h:60
ScriptMgr.h
ChatHandler
Definition
Chat.h:41
ChatHandler::PSendSysMessage
void PSendSysMessage(const char *format,...) ATTR_PRINTF(2
Definition
Chat.cpp:221
CommandScript::CommandScript
CommandScript(const char *name)
Definition
ScriptMgr.cpp:1466
example_commandscript
Definition
example_commandscript.cpp:23
example_commandscript::example_commandscript
example_commandscript()
Definition
example_commandscript.cpp:25
example_commandscript::HandleHelloWorldCommand
static bool HandleHelloWorldCommand(ChatHandler *handler, const char *)
Definition
example_commandscript.cpp:27
example_commandscript::GetCommands
std::vector< ChatCommand > GetCommands() const OVERRIDE
Definition
example_commandscript.cpp:33
AddSC_example_commandscript
void AddSC_example_commandscript()
Definition
example_commandscript.cpp:43
src
server
scripts
Examples
example_commandscript.cpp
Generated on
for Project SkyFire Core by
1.17.0