Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "ScriptPCH.h"
- // #include "Chat.h"
- class GOMove_commandscript : public CommandScript
- {
- public:
- GOMove_commandscript() : CommandScript("GOMove_commandscript") { }
- ChatCommand* GetCommands() const
- {
- static ChatCommand HelloWorldCommandTable[] =
- {
- { "gomove", SEC_GAMEMASTER, true, &GOMove_Command, "", NULL },
- { NULL, 0, false, NULL, "", NULL }
- };
- return HelloWorldCommandTable;
- }
- static bool GOMove_Command(ChatHandler* handler, const char* args)
- {
- enum eEnums
- {
- TEST = 0,
- SPAWN = 1,
- };
- struct GOMove_Data
- {
- GameObject* pGob;bool Face;uint32 Entry;float x;float y;float z;float o;float scale;uint8 Phase;
- };
- static std::map<uint64, GOMove_Data> GOMove;
- static std::map<uint64, bool> GOSaved;
- static std::map<uint64, bool> GOSpawned;
- Player* pPlayer = handler->GetSession()->GetPlayer();
- uint64 GUID = pPlayer->GetGUID();
- if(!args)
- return false;
- char* ID_t = strtok((char*)args, " "); // change (char*)args incase of a crash
- if(!ID_t)
- return false;
- uint32 ID = atoi(ID_t);
- char* ARG_t = strtok(NULL, " ");
- uint32 ARG;
- if(ARG_t)
- ARG = atoi(ARG_t);
- if(GOMove.find(GUID) == GOMove.end())
- GOMove[GUID].Face = false;
- if(!ARG) // no args
- {
- switch(ID)
- {
- case TEST:
- pPlayer->GetSession()->SendAreaTriggerMessage(pPlayer->GetName());
- // printf(pPlayer->GetName());
- return true;
- break;
- }
- }
- else if(!ARG < 1) // args, needs a number, bigger than 0
- {
- switch(ID)
- {
- case SPAWN:
- pPlayer->GetSession()->SendNotification("Entry inserted was: %u", ARG);
- /*
- GameObject* Sel = pPlayer->GetGameObject(1); // GO(str,ARG,x,y,z,o,1,pPlayer:GetPhase(),pPlayer)
- if(!Sel)
- pPlayer->GetSession()->SendNotification("No gameobject found with entry %u", ARG);
- else
- {
- GOMove[GUID].pGob = Sel;
- // SEND_USED(pPlayer, str)
- pPlayer->GetSession()->SendAreaTriggerMessage("%s spawned", Sel->GetName());
- }
- */
- return true;
- break;
- }
- }
- else
- pPlayer->GetSession()->SendNotification("Only numbers above 0");
- return false;
- }
- };
- void AddSC_GOMove_commandscript()
- {
- new GOMove_commandscript();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement