I don't know if i am getting this topic correct. Do you want a one-on-one bet npc or what?
@GmOcean : I think you should register all those people who bet their items. In your script, anyone who won the event regardless if he bet an item or not can win. If that is the case and if i am in the perspective of the player i wouldn't bet my item for i can also win even i do not place one.
Let me try my version. I made it more dynamic :
prontera,150,150,0 script Bet NPC 100,{ if ( .player1 && .player2 && getcharid( 3 ) != .player1 && getcharid( 3 ) != .player2 ) { /* - Player 1 and Player 2 are set - This should not be triggered to those people who bet their items otherwise they cannot claim their items if ever they win */ mes .npc$; mes "Bet NPC is full"; close; } mes .npc$; mes "Hello " + strcharinfo( 0 ) + ". What can i do for you?"; next; switch( select( ( .player1 && .player2 ? "" : "Bet an item" ) + ":" + ( .player1 && .player2 ? "Claim Reward" : "" ) + ":Exit" ) ) { case 1: if ( .player1 ) { /* Check if the first person who bet is other person or not. If not, then we terminate the script */ if ( .player1 == getcharid( 3 ) ) { mes .npc$; mes "Doing this is not good"; break; } mes .npc$; mes "^FF0000" + rid2name( .player1 ) + "^000000 placed " + .bet_amount + "x " + getitemname( .bet_item ); next; mes .npc$; mes "So? do you want to bet the tantamount item " + rid2name( .player1 ) + " placed?"; next; if ( select( "Yes:No" ) - 1 ) break; if ( countitem( .bet_item ) < .bet_amount ) { mes .npc$; mes "You don't have enough items to bet"; break; } delitem .bet_item, .bet_amount; .player2 = getcharid( 3 ); announce rid2name( .player1 ) + " and " + rid2name( .player2 ) + " are fighting for " + .bet_amount + "x " + getitemname( .bet_item ),0; } else { mes .npc$; mes "What item do you want to bet?"; next; getinventorylist; for ( .@i = 0; .@i < @inventorylist_count; .@i++ ) { .@menu$ += getitemname( @inventorylist_id[ .@i ] ); .@menu$ += ":"; } .@s = select( .@menu$ ) - 1; mes .npc$; mes "How many ^FF0000" + getitemname( @inventorylist_id[ .@s ] ) + "^000000 will you bet?"; next; input .@amount; if ( !.@amount ) { mes .npc$; mes "Invalid amount"; break; } if ( countitem( @inventorylist_id[ .@s ] ) < .@amount ) { mes .npc$; mes "You don't have " + .@amount + "x ^FF0000" + getitemname( @inventorylist_id[ .@s ] ) + "^000000"; break; } mes .npc$; mes "Are you sure you want to bet " + .@amount + "x ^FF0000" + getitemname( @inventorylist_id[ .@s ] ) + "^000000?"; next; if ( select( "Yes:No" ) - 1 ) break; .bet_item = @inventorylist_id[ .@s ]; .bet_amount = .@amount; delitem .bet_item, .bet_amount; .player1 = getcharid( 3 ); announce rid2name( .player1 ) + " placed " + .bet_amount + "x " + getitemname( .bet_item ) + " on bet NPC", 0; } break; case 2: if ( getcharid( 3 ) != $wid ) { mes .npc$; mes "You are not the winner of the bet"; } else { /* Check if the winner id that is set is one of the people who bet. If not, reset the winner id */ if ( $wid == .player1 || $wid == .player2 ) { getitem .bet_item, .bet_amount * 2; announce rid2name( getcharid( 3 ) ) + " won the bet",0; .bet_item = 0; .bet_amount = 0; .player1 = 0; .player2 = 0; $wid = 0; } else { mes .npc$; mes "You are not registered on our npc"; $wid = 0; announce rid2name( getcharid( 3 ) ) + " is not registered on our bet npc therefore the npc will reset the winner id",0; } } break; case 3: default: break; } close; OnInit: .npc$ = "[ ^FF0000" + strnpcinfo( 1 ) + "^000000 ]"; end;}// prontera,153,153,0 script Test 100,{ $wid = 0; $wid = getcharid( 3 ); end; }
Didn't fully test though because it is already 1:36 in the morning here in Philippines. I'm sleepy
. Also, this is good for one-on-one betting game.