Please fix the Script please and check if there a possible bug exploit.. thank you so much....
prontera,150,150,5 script Duel Gambling 953,{
set .char2$,strcharinfo(0);
set .char$,strcharinfo(0);
set @npcname$,"[Duel Manager]";
L_mm:
mes @npcname$;
//If already a duel is going on
if(.gambling) {
mes "A duel is starting, please wait until the duel is over.";
close;
}
mes "Hello "+ strcharinfo(0)+",";
//If the challenger and the one accepting the duel have registred and the duel is ready to start
if(.char$ == strcharinfo(0) && .char2$ != "") {
mes "^0000FF" +.char2$+ "^000000 is waiting for you to start the duel.";
if(.zeny) mes "Total bet for the duel is ^FF0000" +.zeny+ "^000000 zeny.";
mes "What would you like to do?";
next;
menu "Start Duel",L_sduel,"Cancel Duel",L_cduel;
}
//If the one accept the duel is going to talk to the npc
if(.waiting) {
mes "The duel will start as soon as the opponent confirms the event.";
close;
}
//If the challenger has registred, speaks again to the npc and no one accepted it
if(.char$ == strcharinfo(0)) {
mes "Please wait for your challenger.";
next;
menu "Cancel Duel",L_cduel,"I will wait",-;
close;
}
//If a challenger has registred, another person speaks to the npc and no one has accepted before
if(.char$ != "") {
mes "Someone is looking for an opponent.";
mes " ";
mes "What would you like to do?";
next;
menu "Duel Information",-,"Accept Duel",L_iduel,"I'm not interested",L_info;
mes @npcname$;
mes "Opponent Information :";
mes "Name ~ ^0000FF"+.char$+"^000000";
if(.zeny) mes "Duel Bet ~ ^FF0000" +.zeny+ "^000000 zeny.";
next;
goto L_mm;
}
//If no challenger is registred.
else {
mes "There is no ongoing duel at the moment.";
mes " ";
mes "What would you like to do?";
next;
menu "Start a Duel",-,"Leave Here",L_info;
set .zeny,callfunc("F_PDZeny",0);
Initnpctimer;
attachrid (getcharid(3,.char$));
mes @npcname$;
mes "Please wait for your opponent.";
announce .char$+ " is looking for an opponent.",bc_map;
close;
}
//This party will run after someone accepted the challenge of a challenger
L_iduel:
set .zeny,callfunc("F_PDZeny",.zeny);
set .waiting,1;
mes @npcname$;
mes "Please wait while i inform your opponent.";
announce "Get ready "+.char$+ ", you now have a challenger.",bc_map;
attachrid (getcharid(3,.char2$));
close;
//After both players registred and the challenger starts the duel.
L_sduel:
mes @npcname$;
mes "We will now commence the duel.";
close2;
attachrid (getcharid(3,.char2$));
warp "pvp_n_1-1",90,50;
attachrid (getcharid(3,.char$));
warp "pvp_n_1-1",110,50;
atcommand "@duel" + .char2$;
attachrid (getcharid(3,.char2$));
atcommand "@accept";
set dueling,1;
// detachrid;
set .gambling,1;
announce .char$+ " has started a duel with " +.char2$+ ".",bc_map;
end;
//If only the challenger is registered and cancels or if both registred and the challenger cancels the duel.
L_cduel:
announce "The duel was canceled by " +.char$,bc_map;
mes @npcname$;
mes "Very well.";
set dueling,0;
set Zeny,Zeny+(.zeny/2);
close2;
if((.char2$ != "") && (attachrid (getcharid(3,.char2$)))) {
attachrid getcharid(3,.char2$);
set Zeny,Zeny+(.zeny/2);
set dueling,0;
// detachrid;
}
set .char$,"";
set .char2$,"";
set .gambling,0;
set .waiting,0;
set .zeny,0;
end;
//If 5 Minutes passed after the challenger registred and no one accepts it.
OnTimer60000:
announce "Time's up, The duel has now been canceled because there was no challenger.",bc_map;
if((.char$ != "") && (attachrid (getcharid(3,.char$)))) {
set Zeny,Zeny+(.zeny/2);
set dueling,0;
}
if((.char2$ != "") && (attachrid (getcharid(3,.char2$)))) {
set Zeny,Zeny+(.zeny/2);
set dueling,0;
}
// detachrid;
set .char$,"";
set .char2$,"";
set .gambling,0;
set .waiting,0;
set .zeny,0;
stopnpctimer;
end;
L_info:
mes @npcname$;
mes "Alright, comeback when you need my service.";
close;
//When a player kills his oppenent.
OnPCKillEvent:
if(!dueling) end;
set Zeny,Zeny+.zeny;
atcommand "@leave";
announce strcharinfo(0)+" has won the duel.",bc_map;
mapwarp "pvp_n_1-1","prontera",149,145;
set dueling,0;
attachrid killedrid;
set dueling,0;
// detachrid;
set .char$,"";
set .char2$,"";
set .gambling,0;
set .waiting,0;
set .zeny,0;
set .waiting,0;
end;
//When a player dies.. (Just incase he doesnt get killed by his oppenent)
OnPCDieEvent:
if(!dueling) end;
if (killerrid == 0)
{
announce "The duel has been canceld because "+strcharinfo(0)+" died.", bc_map;
if (strcharinfo(0) == .char$)
{
attachrid getcharid(3,.char2$);
set Zeny,Zeny+.zeny/2;
}
if (strcharinfo(0) == .char2$)
{
attachrid getcharid(3,.char$);
set Zeny,Zeny+.zeny/2;
}
atcommand "@leave";
set dueling,0;
// detachrid;
set .char$,"";
set .char2$,"";
set .gambling,0;
set .waiting,0;
set .zeny,0;
set .waiting,0;
end;
}
}
//Function for gambling for Zeny
Function script F_PDZeny {
If(!getarg(0)) {
mes @npcname$;
mes "How much would you like to bet?";
mes " ";
mes " ";
mes "^ff0000NOTE^000000 : You can only bet up to 10,000,000z.";
next;
input .@zeny;
If(.@zeny > Zeny || !.@zeny) {
mes @npcname$;
mes "Please make that you have entered a valid amount and that you have bought enough zeny.";
close;
}
set Zeny,Zeny-.@zeny;
return .@zeny;
}
If(getarg(0) > Zeny) {
mes @npcname$;
mes "Please make that you have entered a valid amount and that you have bought enough zeny.";
close;
}
else
set Zeny,Zeny-getarg(0);
set .@zeny,getarg(0)*2;
return .@zeny;
}
Question
caspa
Please fix the Script please and check if there a possible bug exploit.. thank you so much....
pvpbet.txt

Edited by caspaLink to comment
Share on other sites
4 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.