Advertisement
Guest User

Untitled

a guest
Jun 22nd, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.16 KB | None | 0 0
  1. class SpectateSpeedChatCommand : public ChatCommandClass {
  2.     void Triggered(int ID,const TokenClass &Text,int ChatType)
  3.     {
  4.         Console_Output("[BB] blah.\n");
  5.         if (Text.size() > 1 && atof(Text[1].c_str()) )
  6.         {
  7.  
  8.             GameObject *obj = Get_GameObj(ID);
  9.             const wchar_t* nick = Get_Wide_Player_Name(obj);
  10.             float speed = (float)atof(Text[1].c_str());
  11.  
  12.             if (IsOnSpectateList(nick))
  13.             {
  14.                 Console_Output("[BB] '%ls' is setting their spectate speed to %s.\n", nick, Text[1].c_str());
  15.                 char msg[256];
  16.                 sprintf(msg,"cmsgp %d 0,255,0 [RxD] Setting your speed to %s.", ID, Text[1].c_str() );
  17.                 Console_Input(msg);
  18.                 SetMaxSpeed(obj, speed);
  19.             }
  20.             else
  21.             {
  22.                 Console_Output("[BB] '%ls' is not in Spectate mode.\n",nick);
  23.                 char msg[256];
  24.                 sprintf(msg,"cmsgp %d 0,255,0 [RxD] You must be in Spectate Mode to use this command. ", ID );
  25.                 Console_Input(msg);
  26.             }
  27.         }
  28.         else
  29.         {
  30.             char msg[256];
  31.             sprintf(msg,"cmsgp %d 0,255,0 [RxD] You must enter a speed amount.", ID );
  32.             Console_Input(msg);
  33.         }
  34.     }
  35. };
  36.  
  37. ChatCommandRegistrant<SpectateSpeedChatCommand> SpectateSpeedChatCommandReg("!SpectateSpeed;!sspeed",CHATTYPE_TEAM,0,GAMEMODE_ALL);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement