Advertisement
Guest User

Announce Login By Amir Cinderella

a guest
Mar 8th, 2014
763
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.41 KB | None | 0 0
  1. #include "ScriptPCH.h"
  2. #include <cstring>
  3.  
  4. //This function is called when the player logs in (every login)
  5. void OnLogin(Player* pPlayer)
  6. {
  7.     std::string ClassNameString = "";
  8.     switch (pPlayer->getClass())
  9.     {
  10.         case CLASS_WARRIOR:
  11.         ClassNameString = "|cffC79C6E";
  12.         break;
  13.         case CLASS_PALADIN:                
  14.         ClassNameString = "|cffF58CBA";
  15.         break;
  16.         case CLASS_HUNTER:                
  17.         ClassNameString = "|cffABD473";
  18.         break;
  19.         case CLASS_ROGUE:                  
  20.         ClassNameString = "|cffFFF569";
  21.          break;
  22.         case CLASS_PRIEST:                
  23.         ClassNameString = "|cffFFFFFF";
  24.         break;
  25.         case CLASS_SHAMAN:                
  26.         ClassNameString = "|cff0070DE";
  27.         break;
  28.         case CLASS_MAGE:                  
  29.         ClassNameString = "|cff69CCF0";
  30.         break;
  31.         case CLASS_WARLOCK:                
  32.         ClassNameString = "|cff9482C9";
  33.         break;
  34.         case CLASS_DRUID:                  
  35.         ClassNameString = "|cffFF7D0A";
  36.         break;
  37.     }
  38.    
  39.     if(pPlayer->GetTotalPlayedTime() <= 5)
  40.     {
  41.     if (pPlayer->GetTeam() == HORDE)
  42.     {
  43. std:: string pname;
  44. pname = pPlayer->GetName();
  45. char ragezone[250];
  46. snprintf(ragezone, 250, "|TInterface\\ICONS\\INV_BannerPVP_01:15|t |CFFFE8A0EWelCome New Player%s %s|r |CFFFE8A0ETo |CFFE55BB0CruSader-WoW", ClassNameString.c_str(), pname.c_str());
  47. sWorld.SendGlobalText(ragezone,0);
  48. pPlayer->CastSpell(pPlayer,45153,false);
  49. return;
  50.     }
  51.     else
  52.     {
  53. std:: string pname;
  54. pname = pPlayer->GetName();
  55. char ragezone[250];
  56. snprintf(ragezone, 250, "|TInterface\\ICONS\\INV_BannerPVP_02:15|t |CFFFE8A0EWelCome New Player%s %s|r |CFFFE8A0ETo |CFFE55BB0CruSader-WoW", ClassNameString.c_str(), pname.c_str());
  57. sWorld.SendGlobalText(ragezone,0);
  58. pPlayer->CastSpell(pPlayer,45153,false);
  59. return;
  60.     }
  61.     }
  62.     else
  63.     {
  64.     }
  65. }
  66.  
  67. //This function is called when the player logs out
  68. void OnLogout(Player* player)
  69. {
  70.     // player->RemoveAllAuras();
  71. }
  72.  
  73. //This function is called when the player kills another player
  74.        void OnPVPKill(Player* killer, Player* killed)
  75. {
  76. }
  77.  
  78.  void AddSC_onevents()
  79. {
  80.     Script *newscript;
  81.     newscript = new Script;
  82.     newscript->Name = "scripted_on_events";
  83.     newscript->pOnLogin = &OnLogin;
  84.     newscript->pOnLogout = &OnLogout;
  85.     newscript->pOnPVPKill = &OnPVPKill;
  86.  
  87.     newscript->RegisterSelf();
  88. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement