Hello. Please help me. Need fix this script. Mac check doesn't work.
//===== rAthena Script =======================================//= BG Queue System//===== By: ==================================================//= Zeiyan (based on scripts by pajodex) //===== Current Version: =====================================//= 1.0//===============Description==================================// Simple BG Queue System with @joinbg / @leavebg / @bginfo// Comes with Pajodex's Fortress and Rune War BG scripts//==============Notes=========================================// I'm not sure if code is scalable or easy to configure.// Send me a message if there's anything I can improve on it//============================================================
function script F_ShuffleNumbers {
deletearray getarg(2);.@static= getarg(0);.@range= getarg(1)+1-.@static;.@count= getarg(3,.@range);if(.@range<=0||.@count<=0)return0;if(.@count>.@range).@count=.@range;for(.@i=0;.@i<.@range;++.@i).@temparray[.@i]=.@i;for(.@i=0;.@i<.@count;++.@i){.@rand= rand(.@range);set getelementofarray( getarg(2),.@i),.@temparray[.@rand]+.@static;.@temparray[.@rand]=.@temparray[--.@range];}return.@count;}//==================================================================//==================================================================//==================================================================- script bgmain -1,{OnInit:set.n$,"[^0D6501Battlegrounds^000000]";//================@ Commands=========================
bindatcmd "joinbg",strnpcinfo(3)+"::OnAtCmd",0,0;
bindatcmd "leavebg",strnpcinfo(3)+"::OnLeave",0,0;
bindatcmd "bginfo",strnpcinfo(3)+"::OnInfo",0,0;
bindatcmd "bgstart",strnpcinfo(3)+"::OnBgStart",0,0;//=================Add your BG Main NPCs Here=======================
setarray .bgevents$,"runewar#main","fortress#main","domination#main";//================Event Names (in order with NPCS====================
setarray .eventname$,"Rune War Event","Fortress Battlegrounds","Domination";
end;//====================@bgstart================================OnBgStart:if(#BGCD > gettimetick(2)){
dispbottom "Starting Battleground Events have a cooldown of 24 Hours per account.";
dispbottom "Time left: ^FF0000"+ callfunc("Time2Str",.renttime[ atoi( strnpcinfo(2))]+#BGCD );
end;}//==================================================================//===========Check for on going events==============================//==================================================================for(.@i=0;.@i< getarraysize(.bgevents$);.@i++){if(getvariableofnpc(.start,.bgevents$[.@i])){
dispbottom "A battleground event instance for "+.eventname$[.@i]+" is already in progress.";
end;}}//==================================================================//================Check for active registration=====================//==================================================================for(.@i=0;.@i< getarraysize(.bgevents$);.@i++){if(getvariableofnpc(.register,.bgevents$[.@i])){
dispbottom "An active registration for "+.eventname$[.@i]+" is already in progress.";
end;}}//==================================================================
mes .n$;
mes "Which Battleground Event would you like to start?";.@menu_item_size= getarraysize(.eventname$);for(.@i=0;.@i<.@menu_item_size;.@i++){.@menu$=.@menu$+(.@i>0?":":"")+.eventname$[.@i];}.@i= select(.@menu$)-1;
donpcevent .@bgevents$[.@i]+"::OnAtcmd";
announce strcharinfo(0)+" has started "+.@bgevents$[.@i]+".",0;
sleep 1000;set#BGCD,gettimetick(2) + 86400;
end;//==================================================================//===============@joinbg============================================OnAtCmd://==================================================================//===========Check for on going events==============================//==================================================================for(.@i=0;.@i< getarraysize(.bgevents$);.@i++){if(getvariableofnpc(.start,.bgevents$[.@i])){
dispbottom "A battleground event instance for "+.eventname$[.@i]+" is in progress.";
end;}}//==================================================================//================Check for active registration=====================for(.@i=0;.@i< getarraysize(.bgevents$);.@i++){if(getvariableofnpc(.register,.bgevents$[.@i])){set.@regison,.@regison+1;}}//======================================================================//================Sorry no active registration right now================//======================================================================if(.@regison==0&&.@eventison==0){
dispbottom "No battleground registration is active at this time.";
end;}//==================================================================//================Job Check=========================================//==================================================================for(.@i=0;.@i< getarraysize(.bgevents$);.@i++){if(getvariableofnpc(.register,.bgevents$[.@i])){for(.@x=0;.@x< getvariableofnpc(.denyjobsize,.bgevents$[.@i]);.@x++){if(Class== getvariableofnpc(.denyjob[.@x],.bgevents$[.@i])){
dispbottom jobname(Class)+"s are not allowed for "+.eventname$[.@i]+".";
end;}}}}//==================================================================//================Base Level Check==================================//==================================================================for(.@i=0;.@i< getarraysize(.bgevents$);.@i++){if(getvariableofnpc(.register,.bgevents$[.@i])){if(getvariableofnpc(.minblevel,.bgevents$[.@i])>BaseLevel){
dispbottom "You are forbidden from joining this event.";
dispbottom "You need to have a base level of at least "+getvariableofnpc(.minblevel,.bgevents$[.@i])+" to join "+.eventname$[.@i]+".";
end;}}}//===No Active BGs & there is an active registration in progress========//======================================================================//===================Proceed to Registration============================//======================================================================while(.aid[.@i]!= getcharid(3)&&.@i<.size )++.@i;if(.@i<.size ){
dispbottom "You are already in queue.";
dispbottom "Please wait until the game starts.";
end;}
query_sql("SELECT `last_mac` FROM `login` WHERE `account_id` = '"+getcharid(3)+"'",.@mac$);for(.@i=0;.@i< getarraysize(.last_mac$);.@i++){if(.@mac$==.last_mac$[.@i]){
dispbottom "Dual Clients are not allowed for Battleground Events.";
end;}}for(.@i=0;.@i< getarraysize(.bgevents$);.@i++){if(getvariableofnpc(.register,.bgevents$[.@i])){
dispbottom "You are now in queue for "+.eventname$[.@i]+".";
dispbottom "Use this time to prepare your items and equipment.";
announce strcharinfo(0)+" has joined the "+.eventname$[.@i]+".",bc_blue;}}
query_sql("SELECT `last_mac` FROM `login` WHERE `account_id` = '"+getcharid(3)+"'",.last_mac$[.size++]);.aid[.size++]= getcharid(3);for(.@i=0;.@i<.size;++.@i){if(!isloggedin(.aid[.@i])){
deletearray .aid[.@i],1;
deletearray .last_mac$,1;--.@i;--.size;}}
end;//========================@leavebg===========================//======================================================================OnLeave:for(.@i=0;.@i<.size;++.@i){if(.aid[.@i]== getcharid(3)){
deletearray .aid[.@i],1;
deletearray .last_mac$[.@i],1;--.@i;--.size;
dispbottom "You have left the queue for the event.";
announce strcharinfo(0)+" has left the queue for the event!",bc_blue;
end;}}
dispbottom "You are not in queue for any events at this time.";
end;//======================================================================//================On Postpone Event=====================================//======================================================================OnPostpone:
deletearray .aid;
deletearray .last_mac$;
deletearray .@i;
deletearray .size;
end;//======================================================================//================Rune War NPC Event====================================//======================================================================OnRuneStart:
copyarray getvariableofnpc(.aid_,"runewar#main"),.aid,.size;
donpcevent "runewar#main::OnStart";
deletearray .aid;
deletearray .last_mac$;.size =0;
end;//======================================================================//================Fortress BG NPC Event=================================//======================================================================OnFortStart:
copyarray getvariableofnpc(.aid_,"fortress#main"),.aid,.size;
donpcevent "fortress#main::OnStart";
deletearray .aid;
deletearray .last_mac$;.size =0;
end;//======================================================================//===================Dota Match NPC Event===============================//======================================================================OnDominationStart:
copyarray getvariableofnpc(.aid_,"domination#main"),.aid,.size;
donpcevent "domination#main::OnStart";
deletearray .aid;
deletearray .last_mac$;.size =0;
end;//======================================================================//================Information on BG Mechanics===========================//=====================@bginfo==========================================OnInfo:
mes .n$;
mes "ZeiyanRO offers different battlegrounds event.";
mes "I can provide information on the mechanics of each of them.";
next;.@menu_item_size= getarraysize(.eventname$);for(.@i=0;.@i<.@menu_item_size;.@i++){.@menu$=.@menu$+(.@i>0?":":"")+.eventname$[.@i];}.@x= select(.@menu$)-1;for(.@i=0;.@i<.@menu_item_size;.@i++){if(.@i==.@x){
mes "[ ^FF0000"+.eventname$[.@i]+"^000000 ]";
mes "Even Duration:^335EFF "+getvariableofnpc(.duration,.bgevents$[.@i])+" minutes^000000";
mes "Minimum Base Level:^335EFF "+getvariableofnpc(.minblevel,.bgevents$[.@i])+"^000000 ";
mes "Minimum Participants:^335EFF "+getvariableofnpc(.minplayers,.bgevents$[.@i])+"^000000 ";
next;//======================================================================//================Rune War Mechanics====================================//======================================================================if(.@x==0){
mes "[ ^FF0000"+.eventname$[.@x]+"^000000 ]";
mes "Several Runes will appear in the middle of the map that can grant the following power ups:";
next;
mes "[ ^FF0000"+.eventname$[.@x]+"^000000 ]";
mes "^9B00FFInvisibility^000000";
mes "^0028FFDouble Damage^000000";
mes "^FF0000Haste^000000";
mes "^AACC06Illusion^000000";
mes "^06CC21Regeneration^000000";
next;
mes "[ ^FF0000"+.eventname$[.@x]+"^000000 ]";
mes "Whichever team has the most kills before the game ends wins.";
mes "Logging out and abandoning will have penalties for this event.";
close;}//======================================================================//===================Fortress BG Mechanics==============================//======================================================================if(.@x==1){
mes "[ ^FF0000"+.eventname$[.@x]+"^000000 ]";
mes "Each team is spawned in their own mini Fortress that can regenerate their HP/SP.";
next;
mes "[ ^FF0000"+.eventname$[.@x]+"^000000 ]";
mes "Fortresses will drain the enemy player's HP and grant regeneration to owners.";
next;
next;
mes "[ ^FF0000"+.eventname$[.@x]+"^000000 ]";
mes "Whichever team that has the control of the Main Fortress before the end of the game wins.";
mes "Logging out and abandoning will have penalties for this event.";
close;}//======================================================================//===================Domination BG Mechanics============================//======================================================================if(.@x==2){
mes "[ ^FF0000"+.eventname$[.@x]+"^000000 ]";
mes "Capture several flags on the map to gain points more flags captured at a given time will provide more points overtime.";
next;
mes "[ ^FF0000"+.eventname$[.@x]+"^000000 ]";
mes "Whichever team has the most points before the game ends wins.";
mes "Logging out and abandoning will have penalties for this event.";
close;}//======================================================================}}//======================================================================}
Question
3TAJIOH
Hello. Please help me. Need fix this script. Mac check doesn't work.
Link to comment
Share on other sites
5 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.