Schimbare in quest vip

Totalitatea subiectelor care nu respectă regulamentul impus in sectiunea "Probleme şi Întrebări" vor fi stocate aici.
Închis
Avatar utilizator
rawn3cr0
Nivel 2

Nivel 2
Mesaje: 226
Membru din: 08 Iul 2014, 01:26
Aprecieri: 149  
Mulţumiri: 6  
  Rezolvări prob.: 1
Medalii

*Problemă:Quest vip
Tipologie server(PvM / PvP): pvm
*Resursă folosită: *Link exclusiv J4M*-
*ServerFiles utilizat:-
*Syserr:-
Poză:-
*Detalii suplimentare:

Am urmatoarele 2 questuri. Primul pentru VIP si al doilea pentru PREMIUM
Cum schimb in asa fel incat:
-Cand sunt utilizator VIP si vreau sa devin utilizator PREMIUM sa dezactivere utilizatorul VIP si bonusul lui si sa devin utilizator Premium. Si invers...

Pentru VIP

Cod: Selectaţi tot

--[[
###########################
# 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
Penttru PREMIUM

Cod: Selectaţi tot

--[[
###########################
# 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
Avatar utilizator
[RaffaeL]
Software Developer

Software Developer
Mesaje: 3223
Membru din: 19 Mar 2016, 12:58
Server: ...
Aprecieri: 15  
Mulţumiri: 2502  
  Rezolvări prob.: 2
Discord: Copiază ID
 Contact:
Medalii

rawn3cr0 scrie:*Problemă:Quest vip
Tipologie server(PvM / PvP): pvm
*Resursă folosită: *Link exclusiv J4M*-
*ServerFiles utilizat:-
*Syserr:-
Poză:-
*Detalii suplimentare:

Am urmatoarele 2 questuri. Primul pentru VIP si al doilea pentru PREMIUM
Cum schimb in asa fel incat:
-Cand sunt utilizator VIP si vreau sa devin utilizator PREMIUM sa dezactivere utilizatorul VIP si bonusul lui si sa devin utilizator Premium. Si invers...
Definesti functiile global, in questlib.lua/quest_functions, apoi conditionezi questurile, unul de celalalt.
De ex:
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 ]]
            SetP1()   --[[ Global function for set vip ]]
			if pc.is_vip() then
				pc.delete_vip()       --[[ This reset your VIP . ]]
				pc.setqf("time_vip", 0) --[[ Set time expired to 0 ]]
				pc.setqf("used_vip", 0)
			end
         else 
            say("Ok, bye. See later.")   --[[ If you choose 2, meaning 'No,maybe later'. ]]   
         end
Asta este doar un exemplu, restul il faci tu.

Bafta.
Imagine
Imagine
https://www.youtube.com/watch?v=GhYkCIETEto
Do everything, if you know what you're doing, else... Imagine
Ma gasesti si aici: Discord https://discord.gg/5J5GnyZVSR
Afișează semnătura
Avatar utilizator
rawn3cr0
Nivel 2

Nivel 2
Mesaje: 226
Membru din: 08 Iul 2014, 01:26
Aprecieri: 149  
Mulţumiri: 6  
  Rezolvări prob.: 1
Medalii

[RaffaeL] scrie:
rawn3cr0 scrie:*Problemă:Quest vip
Tipologie server(PvM / PvP): pvm
*Resursă folosită: *Link exclusiv J4M*-
*ServerFiles utilizat:-
*Syserr:-
Poză:-
*Detalii suplimentare:

Am urmatoarele 2 questuri. Primul pentru VIP si al doilea pentru PREMIUM
Cum schimb in asa fel incat:
-Cand sunt utilizator VIP si vreau sa devin utilizator PREMIUM sa dezactivere utilizatorul VIP si bonusul lui si sa devin utilizator Premium. Si invers...
Definesti functiile global, in questlib.lua/quest_functions, apoi conditionezi questurile, unul de celalalt.
De ex:
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 ]]
            SetP1()   --[[ Global function for set vip ]]
			if pc.is_vip() then
				pc.delete_vip()       --[[ This reset your VIP . ]]
				pc.setqf("time_vip", 0) --[[ Set time expired to 0 ]]
				pc.setqf("used_vip", 0)
			end
         else 
            say("Ok, bye. See later.")   --[[ If you choose 2, meaning 'No,maybe later'. ]]   
         end
Asta este doar un exemplu, restul il faci tu.

Bafta.
Nu stiu cum sa definesc functia in questlib.lua /:)
Avatar utilizator
Diaconu
Ţepar / Untrusted User

Ţepar / Untrusted User
Mesaje: 754
Membru din: 07 Aug 2013, 21:42
Aprecieri: 0
Mulţumiri: 43  
 Contact:
Medalii

Subiect inactiv, Arhivat!
Imagine
Mult prea slab sa controlez puterea,
Mult prea mic sa inteleg durerea.
Discord: Diaconu#6969 pentru orice fel de ajutor
Afișează semnătura
Închis
Răspunsuri
9
Vizualizări
4331
Răspunsuri
3
Vizualizări
694
Răspunsuri
4
Vizualizări
633
Răspunsuri
1
Vizualizări
145

Înapoi la “Arhivă Probleme şi Întrebări”

  • Informaţie
  • Cine este conectat

    Utilizatori ce ce navighează pe acest forum: Google [Bot] și 48 vizitatori