Jump to content
  • 0

Merged two PVP Scripts need help with Oninit


Veracious

Question


  • Group:  Members
  • Topic Count:  17
  • Topics Per Day:  0.00
  • Content Count:  179
  • Reputation:   17
  • Joined:  04/24/14
  • Last Seen:  

I merged my custom PVP warper script(with the board from emistry's script) with PVP Ladder script from Stolao

 

I tried to give two oninit and also oninit2 but it doesn't work. For now i've set it like one OnCharIfInit and one Oninit but is there any other way to make it work like two oninit, or any other way?

prontera,154,169,4 script Pvp_Ladder 837,{
 
mes "~Sign Reads~";
OnPvpLadder:
mes "Pvp Ladder";
if(getgmlevel() >= .GM){ set .@i,select("Warp to PVP Room:Veiw PVP Records:Leave:Reset PVP Stats");
} else {  set .@i,select("Warp to PVP Room:Veiw PVP Records:Leave"); }
switch(.@i){
        case 1:
            next; {
            mes "[  ^0000ffPVP Warper^000000  ]";
            mes "Hello!";
            mes "Do you want me to warp you to PVP Room?";
            menu "^398315Sure, Bring it on!",warppvp,"^d95353No, thanks.",cancel;
            warppvp:    
            warp "prt_pvp",0,0;
            end;
        }
 
            cancel: {
            next;
            mes "[  ^0000ffPVP Warper^000000  ]";
            mes "One should be courageous, not a coward.";
            end;            
        }
        
        
case 4:
mes "Are you sure you want to delete ALL pvp records?";
if(select("No:Yes")==1) close;
next;
mes "Wait one Moment...";
mes ".....";
cleararray $TOPPK$[0],0,127;
cleararray $TOPPK[0],0,127;
query_sql("DELETE FROM `global_reg_value` WHERE `str` = 'PKCOUNT'");
set .@self, getcharid(3);
set .@size, query_sql("select account_id from `char` where online = 1", .@aid);
for(set .@i,0; .@i<.@size; set .@i,.@i+1) {
if(attachrid(.@aid[.@i])){
set PKCOUNT,0;
} 
}
attachrid(.@self);
mes "Cleared pvp data.";
close;
case 2:
for(set .@i,0; .@i < getarraysize($TOPPK$); set .@i,.@i+1){
mes (.@i+1)+": "+ $TOPPK$[.@i] +" with "+ $TOPPK[.@i] +" kills";
if(.@i % 10 == 0){
if(select("Read More:Leave") == 1){ next; } else { close; }
}
}
case 3: close;
}
close;
OnPCKillEvent:
if(.Options&2 && (agitcheck() || agitcheck2())){
if(getgmlevel() < .GmLvl || .Options&8){
if(.Options&1 || strcharinfo(3) == .Map$){
if(.Options&32){
for(set .@i,.RepeatCount; .@i > 0; set .@i, .@i-1){
set @PKedID[.@i+1], @PKedID[.@i];
}
set @PKedID,killedrid;
}
for(set .@i,1; .@i < .RepeatCount; set .@i,.@i + 1){
if(@PKedID[0] == @PKedID[.@i]){ set .@s, .@s + 1;
} else { set .@i, .RepeatCount + 1; }
}
if(.@s < .RepeatCount){
set PkCount,PkCount+1;
if(.Options&16) setd getd(.PointType$),getd(.PointType$) + .PvpEarned;
for(set .@i,0; .@i < .MaxPlayers; set .@i, .@i + 1){
if(PKCOUNT > $TOPPK[.@i]){
if($TOPPK$[.@i] != strcharinfo(0)){
setarray $TOPPK$[.@i + 1], $TOPPK$[.@i];
setarray $TOPPK[.@i + 1], $TOPPK[.@i];
}
setarray $TOPPK$[.@i],strcharinfo(0);
setarray $TOPPK[.@i],PKCOUNT;
if(.Options&4) Announce ""+strcharinfo(0)+" Now Holds the The number "+.@i+" spot on the Pvp Ladder",bc_all;
}
sleep 1;
}
} else { if(.Options&64) warp "Save",0,0; }
}
}
}
end;
OnCharIfInit:
 
while( 1 ){
 
delwaitingroom;
 
waitingroom "PVP Warper [  "+getmapusers("prt_pvp")+" Players  ]",0;
 
sleep 1000;
 
}
 
end;
 
OnInit:
set .GM,99;
set .MaxPlayers,10; // Number of Players held in Records
set .GmLvl,99; // Highest GM level Able to Hold a Record, if Option 8 is Disabled
set .Map$,"prt_pvp"; // Map Pvp Must Take Place on in order to Count, if Option 1 is Disabled
set .RepeatCount,5; // Number of kills on same person before it detects abuse, max of 128
set .PointType$,"#PvpPoints"; // Name of points earned, E.G. #Cash Points
set .PvpEarned,1; // Number of Pvp Points Earned
set .Options,7; // Bitwise Variable
//   1:  Only Counts Kills on .Map$ if Disabled
//   2:  Disables Record Holding during WOE
//   4:  Announce When Someone Takes a Rank
//   8:  Allow Gms Above level .GmLvl To Be on Ladder
//   16: Gain PvP Points on Kills (#PvpPoints)
//   32: Repeat Kill Protection
//   64: Warp to Save on abuse
// Example: "1+2+4 = 7" No Forced Map, Disables Record Holding during WOE and Announces New Record Holders
bindatcmd("PvpLadder" ,"Pvp_Ladder::OnPvpLadder",0,99); 
end;
 
}
Edited by Veracious
Link to comment
Share on other sites

3 answers to this question

Recommended Posts


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10015
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

you cant have duplicated label within 1 NPC.

you have to combime both of it.

 

just move the whole part in OnCharIfInit below the bindatcmd line inside the OnInit

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  17
  • Topics Per Day:  0.00
  • Content Count:  179
  • Reputation:   17
  • Joined:  04/24/14
  • Last Seen:  

bump

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  17
  • Topics Per Day:  0.00
  • Content Count:  179
  • Reputation:   17
  • Joined:  04/24/14
  • Last Seen:  

you cant have duplicated label within 1 NPC.

you have to combime both of it.

 

just move the whole part in OnCharIfInit below the bindatcmd line inside the OnInit

 

thanks, its working now!

 

//===== EinherjarRO Scripts ================================== 
//= Pvp Ladder
//===== By: ================================================== 
//= Stolao
//===== Current Version: ===================================== 
//= 1.0B
//===== Compatible With: ===================================== 
//= rAthena SVN
//===== Description: =========================================
// Configurable Pvp Ladder
//===== Comments: ============================================
//= [Stolao]
//= Needs bug testing, please report any bugs
//= Unable to test thurally on my comp atm
//===== Additional Comments: =================================
//= 1.00 Initial Release
//= 1.01 Added Location with veiwing of ladder
//= 1.02 Added GM Menu
//= 1.03 Added atcommand
//= 1.04 Shortend menu script
//= 1.05 Added PvpPoints into confug and script
//= 1.06 Added Abuse Protection
//= 1.07 Made Pvp Points Configurable
//= 1.08 Fixed typo in Reset Option
//= 1.09 Made Amount of pvp points earned configurable
//= 1.0A Ajusted Spacing for easier reading
//= 1.0B Added Warp to savepoint on abuse into config
//===== Contact Ifo: =========================================
//= [Stolao]
//= Email: [email protected]
//============================================================
 
 
prontera,154,169,4 script Pvp_Ladder 837,{
 
mes "~Sign Reads~";
OnPvpLadder:
mes "Pvp Ladder";
if(getgmlevel() >= .GM){ set .@i,select("Warp to PVP Room:View PVP Records:Leave:Reset PVP Stats");
} else {  set .@i,select("Warp to PVP Room:Veiw PVP Records:Leave"); }
switch(.@i){
        case 1:
            next; {
            mes "[  ^0000ffPVP Warper^000000  ]";
            mes "Hello!";
            mes "Do you want me to warp you to PVP Room?";
            menu "^398315Sure, Bring it on!",warppvp,"^d95353No, thanks.",cancel;
            warppvp:    
            warp "prt_pvp",0,0;
            end;
        }
 
            cancel: {
            next;
            mes "[  ^0000ffPVP Warper^000000  ]";
            mes "One should be courageous, not a coward.";
            end;            
        }
        
        
case 4:
mes "Are you sure you want to delete ALL pvp records?";
if(select("No:Yes")==1) close;
next;
mes "Wait one Moment...";
mes ".....";
cleararray $TOPPK$[0],0,127;
cleararray $TOPPK[0],0,127;
query_sql("DELETE FROM `global_reg_value` WHERE `str` = 'PKCOUNT'");
set .@self, getcharid(3);
set .@size, query_sql("select account_id from `char` where online = 1", .@aid);
for(set .@i,0; .@i<.@size; set .@i,.@i+1) {
if(attachrid(.@aid[.@i])){
set PKCOUNT,0;
} 
}
attachrid(.@self);
mes "Cleared pvp data.";
close;
case 2:
            next;
for(set .@i,0; .@i < getarraysize($TOPPK$); set .@i,.@i+1){
mes (.@i+1)+": "+ $TOPPK$[.@i] +" with "+ $TOPPK[.@i] +" kills";
if(.@i % 10 == 0){
if(select("Read More:Leave") == 1){ next; } else { close; }
}
}
case 3: close;
}
close;
OnPCKillEvent:
if(.Options&2 && (agitcheck() || agitcheck2())){
if(getgmlevel() < .GmLvl || .Options&8){
if(.Options&1 || strcharinfo(3) == .Map$){
if(.Options&32){
for(set .@i,.RepeatCount; .@i > 0; set .@i, .@i-1){
set @PKedID[.@i+1], @PKedID[.@i];
}
set @PKedID,killedrid;
}
for(set .@i,1; .@i < .RepeatCount; set .@i,.@i + 1){
if(@PKedID[0] == @PKedID[.@i]){ set .@s, .@s + 1;
} else { set .@i, .RepeatCount + 1; }
}
if(.@s < .RepeatCount){
set PkCount,PkCount+1;
if(.Options&16) setd getd(.PointType$),getd(.PointType$) + .PvpEarned;
for(set .@i,0; .@i < .MaxPlayers; set .@i, .@i + 1){
if(PKCOUNT > $TOPPK[.@i]){
if($TOPPK$[.@i] != strcharinfo(0)){
setarray $TOPPK$[.@i + 1], $TOPPK$[.@i];
setarray $TOPPK[.@i + 1], $TOPPK[.@i];
}
setarray $TOPPK$[.@i],strcharinfo(0);
setarray $TOPPK[.@i],PKCOUNT;
if(.Options&4) Announce ""+strcharinfo(0)+" Now Holds the The number "+.@i+" spot on the Pvp Ladder",bc_all;
}
sleep 1;
}
} else { if(.Options&64) warp "Save",0,0; }
}
}
}
end;
 
OnInit:
set .GM,99;
set .MaxPlayers,10; // Number of Players held in Records
set .GmLvl,99; // Highest GM level Able to Hold a Record, if Option 8 is Disabled
set .Map$,"prt_pvp"; // Map Pvp Must Take Place on in order to Count, if Option 1 is Disabled
set .RepeatCount,5; // Number of kills on same person before it detects abuse, max of 128
set .PointType$,"#PvpPoints"; // Name of points earned, E.G. #Cash Points
set .PvpEarned,1; // Number of Pvp Points Earned
set .Options,7; // Bitwise Variable
//   1:  Only Counts Kills on .Map$ if Disabled
//   2:  Disables Record Holding during WOE
//   4:  Announce When Someone Takes a Rank
//   8:  Allow Gms Above level .GmLvl To Be on Ladder
//   16: Gain PvP Points on Kills (#PvpPoints)
//   32: Repeat Kill Protection
//   64: Warp to Save on abuse
// Example: "1+2+4 = 7" No Forced Map, Disables Record Holding during WOE and Announces New Record Holders
bindatcmd("PvpLadder" ,"Pvp_Ladder::OnPvpLadder",0,99);
OnCharIfInit:
 
while( 1 ){
 
delwaitingroom;
 
waitingroom "PVP Warper [  "+getmapusers("prt_pvp")+" Players  ]",0;
 
sleep 1000;
 
}
 
end;
 
}
 
I wanted to slightly change this part

case 2:
            next;
for(set .@i,0; .@i < getarraysize($TOPPK$); set .@i,.@i+1){
mes (.@i+1)+": "+ $TOPPK$[.@i] +" with "+ $TOPPK[.@i] +" kills";
if(.@i % 10 == 0){
if(select("Read More:Leave") == 1){ next; } else { close; }
}
}

 
It displays 1st rank seperately( first rank uses 1 whole space of 10 ranks), after i select "read more" it shows 2-11 ranks, how can i make it start from 1-10?
Edited by Veracious
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...