kusanagy

Item VIP

Oct 15th, 2016
582
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.15 KB | None | 0 0
  1. class vip_token_item1 : public ItemScript
  2. {
  3. public: vip_token_item1() : ItemScript("vip_token_item1") { }
  4.        
  5. bool OnUse(Player* player, Item* item, SpellCastTargets const& /*targets*/)
  6. {
  7. if (player->GetSession()->GetSecurity() == SEC_VIP1)
  8. {
  9. player->GetSession()->SendNotification("You already have VIP.1 access."); /* if player already have VIP access he will get a refund */
  10. player->DestroyItemCount(item->GetEntry(), 1, true, false);
  11. player->AddItem(192001, 1);
  12. player->GetSession()->SendNotification("Your tokens had been refunded.");
  13. return false;
  14. }
  15. else
  16. {
  17.    QueryResult insertvip = LoginDatabase.PQuery("REPLACE INTO `account_access` VALUES(%u, 1, -1)", player->GetSession()->GetAccountId()); /*/will run the sql and give player V,I,P rank wich in my server is SEC_VIP=4 */
  18. player->GetSession()->SetSecurity(SEC_VIP1); /*will set security of that account to 4 so player don't have to logout to get vip privilege */
  19. player->GetSession()->SendNotification("Your account level is now VIP.1 enjoy");
  20. player->DestroyItemCount(item->GetEntry(), 1, true, false);
  21. return true;
  22.   }
  23.        }
  24. };
  25.  
  26. void AddSC_vip_token_item1()
  27. {
  28. new vip_token_item1();
  29. }
Advertisement
Add Comment
Please, Sign In to add comment