Jump to content

rawn3cr0

Member
  • Posts

    103
  • Joined

  • Last visited

  • Feedback

    0%

Posts posted by rawn3cr0

  1. So i have 2 quest. First for VIP users and another for PREMIUM users.

     

    How i can change this for:

     

    When I am a VIP user and I want to become a PREMIUM user to disable the VIP user and his bonus and become Premium user.  And vice versa.

     

     

    For VIP

    --[[
    ###########################
    # Author: VegaS        	  #
    # Skype: sacadatt.amazon  #
    # Date: 09/09/2016    	  #
    # Work time: 14 min       #
    # Quest: Function get VIP #
    ###########################
    ]]
    quest vip begin
    	state start begin
    		function Time()
    			local mTime = 60	--[[ From here change during the general, as the degree of vip to last until the end, and how long to take the bonus, here means 30 day's.]]
    			--local mTime = 60*60*24*30	--[[ From here change during the general, as the degree of vip to last until the end, and how long to take the bonus, here means 30 day's.]]
    				return mTime
    		end	
    		
    		function GetValue()
    			local mValue = { (pc.getqf("used_vip")), (pc.getqf("time_vip")) }	--[[ Get value as it is, and use during a vip. ]]
    				return mValue
    		end
    		
    		function SetBonusVIP()	--[[ This sets the bonuses when you accept the VIP. ]]
    			affect.add_collect(apply.MAX_HP, 5000, vip.Time())	--[[ This sets a bonus as long as VIP is active, you can add what bonus you want, and a lot a bonus. ]]
    			-- // ................ // --
    		end
    		
    		function Resetvip() 			--[[ This reset your VIP when expired. ]]
    			pc.delete_vip() 		--[[ This reset your VIP when expired. ]]
    			pc.setqf("time_vip", 0) --[[ Set time expired to 0 ]]
    			pc.setqf("used_vip", 0) --[[ Set you used the VIP as 0, you can use again. ]]
    			syschat("<Debug> Time of vip expired!") 
    		end
    		
    		function SetVIP()
    			pc.set_vip() 			--[[ It inserts in grade gmlist your VIP table and you do refresh this degree + vip's emblem. ]]	
    			pc.setqf("used_vip", 1) --[[ Set quest value used, you will not be able to use this item until vip degree will not expire. ]]	
    			pc.setqf("time_vip", get_time() + vip.Time())	--[[ Set the time until it expires. ]]	
    			notice_all("<Debug> Player "..pc.get_name().." obtained the degree of VIP!")	--[[ Tell all players as you become a VIP player. ]]	
    			vip.SetBonusVIP()  --[[ Set the bonus ]]
    		end
    	
    		when login with vip.GetValue()[1] > 0 and pc.is_vip() begin
    			if get_time() > vip.GetValue()[2] then
    				vip.Resetvip() --[[ This vip resets when during the (example) 30 day's has expired. ]]
    			end  
    		end 
    		
    --	when login with pc.get_channel_id() == numberChannel and not pc.is_vip() and vip.GetValue()[1] < 1 begin 	--[[ If u login in channel xx and you not are vip, will be disconnect. For who want to make special channel for vip ^^ ]]
    --		syschat("<Debug> You cannot login in this channel, this is special for V.I.P !")
    --		pc.pc_disconnect_with_delay(5)
    --	end
    		
    		when 40002.use begin
    			if pc.countitem(item.get_vnum()) == 0 then	--[[ Check in case you have no item in the inventory. ]]	
    				return syschat("<Debug> I could not find item!")
    				
    			elseif pc.is_vip() then	--[[ Check if you have not used once this quest or if you have not already vip vip degree attached. ]]	
    				return syschat("<Debug> You have already used this quest, and you own vip degree!")
    
    			elseif not pc.can_warp() then	--[[ Check a few windows open last time, and then will have to wait 10 seconds. ]]	
    				return syschat("<Debug> Close all windows, and wait 10 seconds!") 
    			end
    			
    			say_title("VIP:")
    			say("You are sure want to be a VIP?")
    			say("")
    			local choice = select("Yes,of course", "No, maybe later")
    			if choice == 1 then
    				--pc.remove_item(item.get_vnum(), 1)	--[[ Delete item when you accept the vip ]]
    				vip.SetVIP()	--[[ Global function for set vip ]]
    			else 
    				say("Ok, bye. See later.")	--[[ If you choose 2, meaning 'No,maybe later'. ]]	
    			end 
    		end
    	end
    end

    For PREMIUM

    --[[
    ###########################
    # Author: VegaS        	  #
    # Skype: sacadatt.amazon  #
    # Date: 09/09/2016    	  #
    # Work time: 14 min       #
    # Quest: Function get P1  #
    ###########################
    ]]
    quest p1 begin
    	state start begin
    		function Time()
    			--local mTime = 60*60*24*30	--[[ From here change during the general, as the degree of vip to last until the end, and how long to take the bonus, here means 30 day's.]]
    			local mTime = 60	--[[ From here change during the general, as the degree of vip to last until the end, and how long to take the bonus, here means 30 day's.]]
    				return mTime
    		end	
    		
    		function GetValue()
    			local mValue = { (pc.getqf("used_p1")), (pc.getqf("time_p1")) }	--[[ Get value as it is, and use during a vip. ]]
    				return mValue
    		end
    		
    		function SetBonusP1()	--[[ This sets the bonuses when you accept the VIP. ]]
    			affect.add_collect(apply.MAX_HP, 1000, p1.Time())	--[[ This sets a bonus as long as VIP is active, you can add what bonus you want, and a lot a bonus. ]]
    			-- // ................ // --
    		end
    		
    		function Reset1() 			--[[ This reset your VIP when expired. ]]
    			pc.delete_p1() 		--[[ This reset your VIP when expired. ]]
    			pc.setqf("time_p1", 0) --[[ Set time expired to 0 ]]
    			pc.setqf("used_p1", 0) --[[ Set you used the VIP as 0, you can use again. ]]
    			syschat("<Debug> Time of PREMIUM 2 expired!") 
    		end
    		
    		function SetP1()
    			pc.set_p1() 			--[[ It inserts in grade gmlist your VIP table and you do refresh this degree + vip's emblem. ]]	
    			pc.setqf("used_p1", 1) --[[ Set quest value used, you will not be able to use this item until vip degree will not expire. ]]	
    			pc.setqf("time_p1", get_time() + p1.Time())	--[[ Set the time until it expires. ]]	
    			notice_all("<Debug> Player "..pc.get_name().." obtained the degree of PREMIUM 1!")	--[[ Tell all players as you become a VIP player. ]]	
    			p1.SetBonusP1()  --[[ Set the bonus ]]
    		end
    	
    		when login with p1.GetValue()[1] > 0 and pc.is_p1() begin
    			if get_time() > p1.GetValue()[2] then
    				p1.Reset1() --[[ This vip resets when during the (example) 30 day's has expired. ]]
    			end  
    		end 
    		
    --	when login with pc.get_channel_id() == numberChannel and not pc.is_vip() and vip.GetValue()[1] < 1 begin 	--[[ If u login in channel xx and you not are vip, will be disconnect. For who want to make special channel for vip ^^ ]]
    --		syschat("<Debug> You cannot login in this channel, this is special for V.I.P !")
    --		pc.pc_disconnect_with_delay(5)
    --	end
    		
    		when 40004.use begin
    			if pc.countitem(item.get_vnum()) == 0 then	--[[ Check in case you have no item in the inventory. ]]	
    				return syschat("<Debug> I could not find item!")
    				
    			elseif pc.is_p1() then	--[[ Check if you have not used once this quest or if you have not already vip vip degree attached. ]]	
    				return syschat("<Debug> You have already used this quest, and you own p1 degree!")
    				
    
    			elseif not pc.can_warp() then	--[[ Check a few windows open last time, and then will have to wait 10 seconds. ]]	
    				return syschat("<Debug> Close all windows, and wait 10 seconds!") 
    			end
    			
    			say_title("PREMIUM 1:")
    			say("You are sure want to be a PREMIUM 1?")
    			say("")
    			local choice = select("Yes,of course", "No, maybe later")
    			if choice == 1 then
    				--pc.remove_item(item.get_vnum(), 1)	--[[ Delete item when you accept the vip ]]
    				p1.SetP1()	--[[ Global function for set vip ]]
    			else 
    				say("Ok, bye. See later.")	--[[ If you choose 2, meaning 'No,maybe later'. ]]	
    			end 
    		end
    	end
    end

    Best Regards!

  2. I make shop , i add items.. work good, but if i want to add more items when shop is maked, he give me crash core

    After this i reboot the server and my item is duplicated , 1 in inventory, 1 in shop 

    syserr: FDWATCH: peer null in event: ident 20

    Edit: If i delete costume weapon from item proto and i restart server don’t crash 

    Costume system work normally , but if i add in item proto the lines for weapon costume give me crash core when i add items(like poison sword....) in offlineshop 

  3. I solve this with Quest change name (adding * in front of name) , and adding this in InstanceBaseEffect.cpp

        if (IsPC())
        {
            char szText[256];
            std::string szName = GetNameString();
            static D3DXCOLOR s_kLevelColor = D3DXCOLOR(152.0f / 255.0f, 255.0f / 255.0f, 51.0f / 255.0f, 1.0f);
            if (IsGameMaster())
            {
                char* szName[1] = { "[GM]" }; /* Name of grade */
                char* szColor[1] = { "49ff00" }; /* Color of grade: http://www.color-hex.com/color/ccffff */
    
                sprintf(szText, "|cFF%s%s|r Lv. %d", szColor[0], szName[0], level);
    
                CPythonTextTail::Instance().AttachLevel(GetVirtualID(), szText, s_kLevelColor);
            }
            else if (szName.find("*") != std::string::npos)
            {
                char* szName[1] = { "[VIP]" }; /* Name of grade */
                char* szColor[1] = { "f0ff00" }; /* Color of grade: http://www.color-hex.com/color/ccffff */
    
                sprintf(szText, "|cFF%s%s|r Lv. %d", szColor[0], szName[0], level);
                CPythonTextTail::Instance().AttachLevel(GetVirtualID(), szText, s_kLevelColor);
            }
            else
                return;
            CPythonTextTail::Instance().AttachLevel(GetVirtualID(), szText, s_kLevelColor);
        }

    3chCSet.jpg

×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.