[MEGA RELEASE]Automatic Ox-Event System

03/17/2013 09:55 HaveBeen™#1


PHP Code:
--[[
    -- 
Automatic OX-Event System
    
-- Quest Writer By HaveBeen™
    
-- Thank for help -TÜRKxD
    
-- For E*PVP
]]--
quest oxevents begin
    state start begin
    
    
function open()
        if(
oxevent.open() == 0then
            
return 0
        
elseif(oxevent.open() == 1then
            
return 1
        
else
            return 
2
        end
    end
    
    
function quiz()
        if(
oxevent.quiz(1,30) == 0then
            
return 0
        
elseif(oxevent.quiz(1,30) == 1then
            
return 
        
else
            return 
2
        end
    end
    
    
function check()
        
local gmlist = {"HaveBeen"} -- Enter the names of GameMaster
        
for 1,table.getn(gmlist),do
            if(
gmlist[i] == pc.namethen
                
return true
            
else
                return 
false
            end
        end
    end
    
    
    when 20011.chat
."GM: Ox Event" with pc.is_gm() and oxevents.check() == true and game.get_event_flag("automatic_oxevent_status") == 0 begin
        say_title
(mob_name(npc.get_race())..":"
        
say(""
        --- 
        
say("Do you want to open the Ox-Event? "
        
say(""
        
local s select(locale.yes,locale.no
        
        if(
== 2then 
            
return 
        
end 
            say_title
(mob_name(npc.get_race())..":"
            
say(""
            --- 
            
say_reward("Note : Actual Ox Event Time (H) : "..os.date("%H")) 
            
say(""
            
say("How much do you want to open Ox Event?"
            
            
local times tonumber(input())
            
            if(
times == "" or tonumber(times) == nilthen 
                
return 
            
end 
            game
.set_event_flag("automatic_oxevent_opentime",times)             
    
            
say_title(mob_name(npc.get_race())..":"
            
say(""
            
            --- 
            
say("Thank you the system has been activated! "
            
say("Open after "..times.." hours! "
            
game.set_event_flag("automatic_oxevent_status",1
            
server_timer('check',5
        
end 
    
    when check
.server_timer begin
        
if(os.date("%H") == game.get_event_flag("automatic_oxevent_opentime")) then
            
if(oxevents.open() == 0then
                
print("The competition is already active! ")
            elseif(
oxevents.open() == 1then
                notice_all
("<Notice> Ox-Event is opened! ")
                
notice_all("<Notice> Show your knowledge.. ")
                
server_timer('countdownone',300)
            else
                print(
"An Error has occurred.. ")
            
end
        
else
            
server_timer('checktwo',5)
        
end
    end
    
    when checktwo
.server_timer begin
        
if(os.date("%H") == game.get_event_flag("automatic_oxevent_opentime")) then
            
if(oxevents.open() == 0then
                
print("The competition is already active! ")
            elseif(
oxevents.open() == 1then
                notice_all
("<Notice> Ox-Event is opened! ")
                
notice_all("<Notice> Show your knowledge.. ")
                
server_timer('countdownone',300)
            else
                print(
"An Error has occurred.. ")
            
end
        
else
            
server_timer('check',5)
        
end
    end    
    
    when countdownone
.server_timer begin
        notice_all
("<Notice> Closing Ox-Event Entries : 5 mins left.. ")
        
server_timer("countdowntwo",60)
    
end
    
    when countdowntwo
.server_timer begin
        notice_all
("<Notice> Closing Ox-Event Entries : 4 mins left.. ")
        
server_timer("countdownthree",60)
    
end
    
    when countdownthree
.server_timer begin
        notice_all
("<Notice> Closing Ox-Event Entries : 3 mins left.. ")
        
server_timer("countdownfour",60)
    
end
    
    when countdownfour
.server_timer begin
        notice_all
("<Notice> Closing Ox-Event Entries : 2 mins left.. ")
        
server_timer("countdownfive",60)
    
end
    
    when countdownfive
.server_timer begin
        notice_all
("<Notice< Closing Ox-Event Entries : 1 mins left.. ")
        
server_timer("countdown",60)
    
end
    
    when countdown
.server_timer begin
        notice_all
("<Ox-Event> All Ox-Event entries are closed. "
        
notice_all("<Ox-Event> No longer you can enter as a competitor. "
        
notice_all("<Ox-Event> Now you can enter only as a spectator. "
        
game.set_event_flag("automatic_oxevent_status",2)
        
server_timer('playercheck',10)
        
game.set_event_flag("automatic_oxevent_opentime",0)
    
end
    
    when playercheck
.server_timer begin
        
if(pc.get_map_index() == 113then
            
if(oxevent.get_attender() == 0then
                notice_all
("<Ox-Event> There is no one in the Ox-Event. "
                
notice_all("<Ox-Event> Ox-Event is automatically closing. "
                
game.set_event_flag("automatic_oxevent_status",0)
                
game.set_event_flag("automatic_oxevent_opentime",0)
                
warp_all_to_village()
            else
                
server_timer('oxeventstart',10)
            
end
        end
    end
    
    when oxeventstart
.server_timer begin
        
if(pc.get_map_index() == 113then
            
if(oxevents.quiz() == 0then
                
print("Ox-Event stopped! ")
            elseif(
oxevents.quiz() == 1then
                notice_in_map
("A question asked."
                
server_timer("goon",30)
            else
                print(
"A question has already been asked. "
            
end
        
else
            return
        
end
    end
    
    when goon
.server_timer begin
        
-- Check
        
if(oxevent.get_attender() == 0then
            notice_in_map
("There is no one in the Ox-Event. "
            
notice_in_map("Ox-Event is ended automatically. "
            
game.set_event_flag("automatic_oxevent_status",0)
            
game.set_event_flag("automatic_oxevent_opentime",0)
            
warp_all_to_village()
        elseif(
oxevent.get_attender() == 1then
            notice_in_map
("Ox-Event is successfully finished. "
            
notice_in_map("The last remaining player are awarded. "
            
local itemlist = {11299,11499,11699,11899}
            
game.drop_item(itemlist[number(1,table.getn(itemlist))],1)
            
game.set_event_flag("automatic_oxevent_status",0)
            
game.set_event_flag("automatic_oxevent_opentime",0)
            
server_timer("over",20)
        else
            
server_timer("goontwo",30)
        
end
    end
    
    when over
.server_timer begin
        warp_all_to_village
()
    
end
    
    when goontwo
.server_timer begin
        
-- Check
        
if(oxevent.get_attender() == 0then
            notice_in_map
("There is no one in the Ox-Event. "
            
notice_in_map("Ox-Event is ended automatically. "
            
game.set_event_flag("automatic_oxevent_status",0)
            
game.set_event_flag("automatic_oxevent_opentime",0)
            
warp_all_to_village()
        elseif(
oxevent.get_attender() == 1then
            notice_in_map
("Ox-Event is successfully finished. "
            
notice_in_map("The last remaining player are awarded. "
            
local itemlist = {11299,11499,11699,11899}
            
game.drop_item(itemlist[number(1,table.getn(itemlist))],1)
            
game.set_event_flag("automatic_oxevent_status",0)
            
game.set_event_flag("automatic_oxevent_opentime",0)
            
server_timer("over",20)
        else
            
server_timer("goon",30)
                
end
    end
    
    when 20011.chat
."Ox-Event" begin
        
if(game.get_event_flag("automatic_oxevent_status") == 2then 
            say
("All entries are closed. "
            
say("Now you can go only as a spectator. "
            
local s select(locale.yes,locale.no
            
            if(
== 2then 
                
return 
            
end 
            
            pc
.warp(89630028900
    
        elseif(
game.get_event_flag("automatic_oxevent_status") == 1then 
            say
("Now all Ox-Event entries are open. "
            
say("Do you want to go as a competitor? "
        
            
local s select("Yes, As A Competitor.","No, As A Spectator."
        
            if(
== 1then 
                pc
.warp(89650024600
            elseif(
== 3then 
                pc
.warp(89630028900
                
end 
            end 
        end 
    end 
end 
this is code add quest_functions..

PHP Code:
print 
Here is the German Quest ;; Thanks to [SA]Con :D

Only for epvp :mofo:

Thank for help -TÜRK- :cool:

King Regards !
Mfg HaveBeen™

03/17/2013 09:57 thehero09#2
Thanks Mk :D
03/17/2013 09:58 HaveBeen™#3
Quote:
Originally Posted by thehero09 View Post
Thanks Mk :D
Damn you :rolleyes:
03/17/2013 10:06 -TÜRK-#4
Thanks Dude :)

Bad english but, good quest .. :D
03/17/2013 11:17 PrinZDaniieL#5
when countdownfive.timer begin
notice_all("<Notice< Closing Ox-Event Entries : 1 mins left.. ")
timer("countdown",60)

it must be ("<Notice>
03/17/2013 11:24 HaveBeen™#6
Quote:
Originally Posted by lillakilla View Post
when countdownfive.timer begin
notice_all("<Notice< Closing Ox-Event Entries : 1 mins left.. ")
timer("countdown",60)

it must be ("<Notice>
Thanks fixed :)
03/17/2013 11:25 [SA]Con#7
Hier mal für die Faulen die Quest auf Deutsch.
Here is the German Quest.


Fals ich etwas falsch Übersetzt habe, sagt es mir bitte und ich werde es Korrigieren! ;)

BTW: Thanks to -TÜRK- and HaveBeen for this Quest! :D
03/17/2013 11:51 HaveBeen™#8
Quote:
Originally Posted by -TÜRK- View Post
Thanks Dude :)

Bad english but, good quest .. :D
I didn't say anything :D
03/17/2013 11:53 -TÜRK-#9
Quote:
Originally Posted by HaveBeen™ View Post
I didn't say anything :D
I fixed strange english :D
03/17/2013 12:00 [SGA]Jango#10
Wenn der GM sich ausloggt dann funktioniert der timer nicht! du must server_timer benutzen!
When GM logout, the timer stop! You must use server_timer!
03/17/2013 12:07 Cescoso#11
Quote:
Originally Posted by [SGA]Jango View Post
Wenn der GM sich ausloggt dann funktioniert der timer nicht! du must server_timer benutzen!
When GM logout, the timer stop! You must use server_timer!
It's not the only one bug. It's deeply bugged yet
03/17/2013 12:07 -TÜRK-#12
Quote:
Originally Posted by [SGA]Jango View Post
Wenn der GM sich ausloggt dann funktioniert der timer nicht! du must server_timer benutzen!
When GM logout, the timer stop! You must use server_timer!
Thanks. :)

We've got a big bug. :facepalm:
03/17/2013 12:20 αнтιη#13
Thanks :)
03/17/2013 12:20 sermandes#14
Thanks man
03/17/2013 12:27 Cescoso#15
I've to inform you that this script won't work in any possible situation.
There're a couple of ways to stuck/block/bug it, using server_timer will help you fixing some of them, in any case it's a buggy ox event. Test and trust.
I think i'll release my stable version (more than 6 test month), i'll make you know.
Acqua