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
endCod: 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





