Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool cChat::BuyVIPCommand(LPOBJ gObj, char *Msg)
- {
- if(Vip.Config.Enabled)
- {
- int Hours = 1;
- char State[255];
- sscanf(Msg, "%s %d", &State, &Hours);
- int RealState = -1;
- for(int i = 1; i<= Vip.Config.NumStates; i++)
- {
- if(!_strcmpi(State, Vip.Config.VIPState[i].VIPName))
- {
- RealState = i;
- break;
- }
- }
- if(AddTab[gObj->m_Index].VIP_Type > 0 || AddTab[gObj->m_Index].VIP_Min > 0)
- {
- if(Vip.Config.AllowRebuying)
- {
- if(AddTab[gObj->m_Index].VIP_Type != RealState)
- {
- MessageLog(1, c_Red, t_VIP, gObj, "[VIPBuy] You can't buy another type of vip.");
- return true;
- }
- }
- else
- {
- MessageLog(1, c_Red, t_VIP, gObj, "[VIPBuy] You have already bought VIP.");
- return true;
- }
- }
- if(RealState == -1)
- {
- MessageLog(1, c_Red, t_VIP, gObj, "[VIP] There are no such vip status.");
- return true;
- }
- if(!Vip.Config.VIPState[RealState].EnabledCmd)
- {
- MessageLog(1, c_Red, t_VIP, gObj, "[VIP] You can't buy %s vip status.", Vip.Config.VIPState[RealState].VIPName);
- return true;
- }
- if(Hours < Vip.Config.VIPState[RealState].MinHours || Hours > Vip.Config.VIPState[RealState].MaxHours)
- {
- MessageLog(1, c_Red, t_VIP, gObj, "[VIP] You can't buy less then %d and more than %d hours.", Vip.Config.VIPState[RealState].MinHours, Vip.Config.VIPState[RealState].MaxHours);
- return true;
- }
- if(CheckCommand(gObj, Vip.Config.VIPState[RealState].EnabledCmd, GmSystem.NONE, Vip.Config.VIPState[RealState].CostZen * Hours,
- Vip.Config.VIPState[RealState].CostPCPoints * Hours, Vip.Config.VIPState[RealState].CostWCoins * Hours, 0, 2, 0, "VIPBuy", "/vipbuy <state> <hours>", Msg))
- return true;
- TakeCommand(gObj, Vip.Config.VIPState[RealState].CostZen * Hours, Vip.Config.VIPState[RealState].CostPCPoints * Hours,
- Vip.Config.VIPState[RealState].CostWCoins * Hours, "BuyVIP");
- MuOnlineQuery.ExecQuery("UPDATE MEMB_INFO SET %s = (%s + %d), %s = %d WHERE MEMB__ID = '%s'", Vip.Config.ColumnDate, Vip.Config.ColumnDate, Hours*60, Vip.Config.Column, RealState, gObj->Name);
- MuOnlineQuery.Fetch();
- MuOnlineQuery.Close();
- AddTab[gObj->m_Index].VIP_Min += Hours*60;
- AddTab[gObj->m_Index].VIP_Type = RealState;
- MessageLog(1, c_Red, t_VIP, gObj, "[VIPBuy] Successfully bought %s for %d Hour(s)", Vip.Config.VIPState[RealState].VIPName, Hours);
- MessageLog(1, c_Red, t_VIP, gObj, "[VIPBuy] Your VIP status starts right now!");
- }
- return true;
- }
Add Comment
Please, Sign In to add comment