Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- *╔═╦═╦═╦╦╦══╦═╦╗─╔╦══╗
- *║╦╣║║║║║╠╗╗║╦╣╚╦╝║══╣
- *║╩╣║║║║║╠╩╝║╩╬╗║╔╬══║
- *╚═╩╩═╩╩═╩══╩═╝╚═╝╚══╝
- * http://emudevs.com
- */
- class cmd_tutorial : public CommandScript
- {
- public:
- cmd_tutorial() : CommandScript("cmd_tutorial") { }
- ChatCommand* GetCommands() const OVERRIDE
- {
- static ChatCommand commandInfoTable[] =
- {
- { "info", SEC_PLAYER, false, &HandleTestInfoCommand, "", NULL },
- { "emote", SEC_PLAYER, false, &HandleTestInfoCommand, "", NULL },
- { NULL, 0, false, NULL, "", NULL }
- };
- static ChatCommand commandTable[] =
- {
- { "test", SEC_PLAYER, false, &HandleTestCommand, "", commandInfoTable },
- { NULL, 0, false, NULL, "", NULL }
- };
- return commandTable;
- }
- static bool HandleTestCommand(ChatHandler* handler, const char* /* args */)
- {
- Player* player = handler->GetSession()->GetPlayer();
- if (!player)
- return false;
- return true;
- }
- static bool HandleTestInfoCommand(ChatHandler* handler, const char* args)
- {
- if (!*args)
- return false;
- Player* player = handler->GetSession()->GetPlayer();
- if (!player)
- return false;
- char* arg1 = strtok((char*)args, " ");
- char* arg2 = strtok((char*)NULL, "");
- if (!arg1 || !arg2)
- return false;
- uint32 itemId = (uint32)atoi(arg1);
- uint32 itemCount = (uint32)atoi(arg2);
- if (!itemId || itemCount)
- return false;
- player->AddItem(itemId, itemCount);
- return true;
- }
- };
- void AddSC_custom_thing()
- {
- new cmd_tutorial();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement