Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class vip_token_item1 : public ItemScript
- {
- public: vip_token_item1() : ItemScript("vip_token_item1") { }
- bool OnUse(Player* player, Item* item, SpellCastTargets const& /*targets*/)
- {
- if (player->GetSession()->GetSecurity() == SEC_VIP1)
- {
- player->GetSession()->SendNotification("You already have VIP.1 access."); /* if player already have VIP access he will get a refund */
- player->DestroyItemCount(item->GetEntry(), 1, true, false);
- player->AddItem(192001, 1);
- player->GetSession()->SendNotification("Your tokens had been refunded.");
- return false;
- }
- else
- {
- 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 */
- player->GetSession()->SetSecurity(SEC_VIP1); /*will set security of that account to 4 so player don't have to logout to get vip privilege */
- player->GetSession()->SendNotification("Your account level is now VIP.1 enjoy");
- player->DestroyItemCount(item->GetEntry(), 1, true, false);
- return true;
- }
- }
- };
- void AddSC_vip_token_item1()
- {
- new vip_token_item1();
- }
Advertisement
Add Comment
Please, Sign In to add comment