-
Content Count
366 -
Joined
-
Last visited
-
Days Won
8
Content Type
Profiles
Forums
Downloads
Staff Applications
Calendar
Everything posted by Patskie
-
[Question] how to make a script to bet an item
Patskie replied to Takumirai's question in Script Support
I am aware that when server shuts down. The bet npc is at mess. LOL but too lazy to make an SQL dependent script HAHA. K i leave here -
[Question] how to make a script to bet an item
Patskie replied to Takumirai's question in Script Support
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. -
Change : sleep rand(1000,1000); to : sleep 60 * 1000;
-
prontera,150,150,0 script Sample 100,{ mes .npc$; mes "Hello " + strcharinfo( 0 ) + ". What can i do for you?"; next; switch( select( implode( .menu$, ":" ) ) ) { case 1: mes .npc$; mes "Enter your current password"; next; input .@cp$; query_sql "SELECT `user_pass` FROM `login` WHERE `account_id` = '" + getcharid( 3 ) + "'", .@up$; if ( .@up$ != .@cp$ ) { mes .npc$; mes "Your current password doesn't match the password you have provided"; break; } mes .npc$; mes "Enter your new password"; next; input .@np$; mes .npc$; mes "Are you sure you want to change your password?"; next; if ( select( "Yes:No" ) - 1 ) break; query_sql "UPDATE `login` SET `user_pass` = '" + escape_sql( .@np$ ) + "' WHERE `account_id` = '" + getcharid( 3 ) + "'"; mes .npc$; mes "Your password has been changed"; break; case 2: query_sql "SELECT `email` FROM `login` WHERE `account_id` = '" + getcharid( 3 ) + "'", .@email$; mes .npc$; mes "Your current email is : ^FF0000" + .@email$ + "^000000"; next; if ( select( "Change my e-mail:Oh that is the e-mail i want to have" ) - 1 ) break; mes .npc$; mes "Enter your new e-mail"; next; input .@new_email$; mes .npc$; mes "Do you really want to change your e-mail from ^FF0000" + .@email$ + "^000000 to ^FF0000" + .@new_email$ + "^000000?"; next; if ( select( "Yes:No" ) - 1 ) break; query_sql "UPDATE `login` SET `email` = '" + escape_sql( .@new_email$ ) + "'"; mes .npc$; mes "Your e-mail has been changed"; break; case 3: mes .npc$; mes "Your current gender is ^FF0000" + ( Sex ? "Male" : "Female" ) + "^000000"; next; if ( select( "I wish to change my gender:Okay" ) - 1 ) break; mes .npc$; mes "Are you sure you want to change your sex? By doing this, I will kick you out of the game"; if ( select( "Yes:No" ) - 1 ) break; changesex; break; case 4: mes .npc$; mes "Thank you for using this useful in-game control panel"; break; default: break; } close; OnInit: .npc$ = "[ ^FF0000" + strnpcinfo( 1 ) + "^000000 ]"; setarray .menu$[ 0 ], "Password Change", "E-mail Change", "Sex Change", "Exit"; end;} Incomplete.
-
- script hourly_points -1,{OnInit: //Configs .time = 60 * 60 * 1000; // Time in milliseconds. Default: 1 hour (60 * 60 * 1000) .max_idle = 15 * 30; // Maximum idle time in seconds .points = 1; // Points to give the user each active hour. .points_variable$ = "#CASHPOINTS"; // Variable name to store the points end;OnPCLoginEvent: addtimer .time, strnpcinfo(3)+"::OnPoints"; end;OnPoints: if (checkidle() < .max_idle && checkvending() != 2) { setd .points_variable$, getd(.points_variable$) + .points; dispbottom "Current Balance = " + #CASHPOINTS; goto OnPCLoginEvent; } end;} Would trigger once only after script has been executed. You can access character and account variables. In your example instead of doing too many query_sql commands. You can do like dispbottom "Current Balance = " + hourlypoints;
-
Override it with bindatcmd command and add a check if the player meet the criteria in your description. If so, allow them otherwise end the script.
-
OnPCDieEvent: if ( killerrid > 3000000 ) { // killed by monster } else { // killed by player }
-
- script Sample -1,{ OnInit: bindatcmd "giveitems",strnpcinfo( 3 )+"::OnCommnad",99,99; end; OnPCLoginEvent: .players[ getarraysize( .players ) ] = getcharid( 3 ); end; OnPCLogoutEvent: for ( .@i = 0; .@i < getarraysize( .players ); .@i++ ) { if ( getcharid( 3 ) == .players[ .@i ] ) deletearray .players[ .@i ], 1; } end; OnCommnad: if ( .@atcmd_numparameters < 2 ) message strcharinfo( 0 ),"Usage: @giveitems <item id> <item amount>"; else { .@id = atoi( .@atcmd_parameters$[ 0 ] ); .@amount = atoi( .@atcmd_parameters$[ 1 ] ); .@map$ = strcharinfo( 3 ); .@origin = getcharid( 3 ); .c = 0; if ( getitemname( .@id ) == "null" ) { message strcharinfo( 0 ),"Ivalid item id"; end; } for ( .@i = 0; .@i < getarraysize( .players ); .@i++ ) { if ( attachrid( .players[ .@i ] ) ) { if ( strcharinfo( 3 ) == .@map$ && !getgmlevel() ) { getitem .@id, .@amount; .c++; } } } attachrid( .@origin ); message strcharinfo( 0 ),"Gave items to " + .c + " character" + ( .c > 1 ? "s" : "" ); } end;} Try :3
-
Change : OnAtcommand: atcommand "@me " +.Messages$[rand(getarraysize(.Messages$))]; end; to : OnAtcommand: if ( gettimetick(2) < #timer ) end; atcommand "@me " +.Messages$[rand(getarraysize(.Messages$))]; #timer = gettimetick(2) + 10; end;
-
Get @Euphy event manager
-
- script Sample -1,{ OnInit: bindatcmd "buff", strnpcinfo( 3 )+"::OnBuff"; end; OnBuff: if ( getgroupid() > 40 ) end; specialeffect2 EF_INCAGILITY; sc_start SC_INC_AGI,240000,10; specialeffect2 EF_BLESSING; sc_start SC_BLESSING,240000,10; end;}
-
Change : atcommand "@font " + .@atcmd_parameters$; to : atcommand "@font " + implode( .@atcmd_parameters$, " " );
-
- script Sample -1,{ OnInit: setarray .Maps$[0], "prontera","Prontera Midgard", "payon","Payon Forest"; .size = getarraysize( .Maps$ ); for ( .@i = 0; .@i < .size; .@i += 2 ) setmapflag .Maps$[ .@i ], mf_loadevent; end; OnPCLoadMapEvent: getmapxy( .@map$, .@x, .@y, 0 ); for ( .@i = 0; .@i < .size; .@i += 2 ) { if ( .@map$ == .Maps$[ .@i ] ) announce "You entered map : " + .Maps$[ .@i + 1 ] + ".",bc_self; } end;}
-
Use pascal case on the first letter after L_
-
Redeemer NPC / Coupon NPC / Promotional NPC
Patskie replied to ThyroDree's question in Script Requests
Show error message if any -
Need this script applied to the party, not only the killer in the party
Patskie replied to Adam's question in Script Support
Replace : for ( .@i = 0; .@i < $@partymembercount; .@i++ ) { if ( isloggedin( $@partymemberaid[.@i], $@partymembercid[.@i] ) ) { attachrid $@partymemberaid[.@i]; if ( strcharinfo(3) != .@map$ || checkidle() > 10 ) continue; if ( rand(4000) < 25 ) // .@rand_gc_drop ... 25/4000 = 1/160 getitem 512,1; if ( rand(2000) < 5 ) // .@rand_sc_drop .... 5/2000 = 1/400 getitem 513,1; if ( rand(1000) < 1 ) // .@rand_gc_drop .... 1/1000 getitem 511,1; }} by : for ( .@i = 0; .@i < $@partymembercount; .@i++ ) { if ( isloggedin( $@partymemberaid[.@i], $@partymembercid[.@i] ) ) .c++;}for ( .@i = 0; .@i < $@partymembercount; .@i++ ) { if ( isloggedin( $@partymemberaid[.@i], $@partymembercid[.@i] ) ) { attachrid $@partymemberaid[.@i]; if ( strcharinfo(3) != .@map$ || checkidle() > 10 || .c < 2 ) continue; if ( rand(4000) < 25 ) // .@rand_gc_drop ... 25/4000 = 1/160 getitem 512,1; if ( rand(2000) < 5 ) // .@rand_sc_drop .... 5/2000 = 1/400 getitem 513,1; if ( rand(1000) < 1 ) // .@rand_gc_drop .... 1/1000 getitem 511,1; }}.c = 0; -
Good luck on your real life @Yommy!
-
http://herc.ws/board/topic/2455-introducing-bank-support/
-
Prevent equipping of certain item on certain map
Patskie replied to Lelantos's question in Script Requests
- script Sample -1,{ OnPCLoadMapEvent: getmapxy( .@map$, .@x, .@y, 0 ); while ( .@map$ == "prontera" ) { if ( getequipid( 2 ) != -1 ) unequip 2; sleep2 100; } end;}prontera mapflag loadevent @EDIT : Refer to getequipid and unequip for you desires. In my sample it unequips your armor -
- script Sample -1,{ OnNPCKillEvent: if ( getmonsterinfo( killedrid, MOB_MODE ) & 0x0020 ) { if ( getmonsterinfo( killedrid, MOB_MVPEXP ) ) { if ( getmonsterinfo( killedrid, MOB_LV ) < 71 ) #CASHPOINTS += rand( 1, 50 ); else #CASHPOINTS += rand( 50, 100 ); } else #CASHPOINTS += rand( 1, 10 ); } end;}
-
I forgot to put " " lols
-
OnNPCKillEvent: if ( strcharinfo( 3 ) != "prt_fild04" || killedrid != 1002 ) end; getitem 7227, 1; end;