Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 05/24/21 in all areas

  1. too many loop, simplify your script prontera,181,204,4 script Card Buyer 658,{ mes "[Card Buyer]"; mes "You have any card to sell ? <3"; next; getinventorylist; for (.@i = 0; .@i < @inventorylist_count; .@i++) { .@card_id = @inventorylist_id[.@i]; .@card_qt = @inventorylist_amount[.@i]; if (getiteminfo(.@card_id, 2) != 6) continue; // skip not card // find if this card can be sold to this npc .@f = inarray(.card_list, .@card_id); // not in list card that can be sold, skip! if (.@f == -1) continue; .@menu$[.@n] = getitemname(.@card_id) + callfunc("F_InsertComma", .card_price[.@card_id]); .@card_ids[.@n] = .@card_id; .@card_qts[.@n] = .@card_qt; .@n++; } .@s = select(implode(.@menu$, ":")) -1; mes "[Card Buyer]"; .@card_id = .@card_ids[.@s]; .@card_qt = .@card_qts[.@s]; mes "You want to sell "+ getitemname(.@card_id) +"?"; mes "I will pay you "+ callfunc("F_InsertComma", .card_price[.@card_id]) +"z/ea"; .@total = .card_price[.@card_id] * .@card_qt; mes "Total Price: "+ callfunc("F_InsertComma", .@total)+"z."; select("Yes"); delitem .@card_id, .@card_qt; Zeny += .@total; mes "[Card Buyer]"; mes "Thank you for your patronage!"; close; OnInit: function AddCard; /* @param price in zeny @param "card id:card id:card id:...." Sample: AddCard(10000, "4001:4002:4003"); */ freeloop(true); AddCard(100000, "4032:4013:4023:4009:4004:4002:4026:4019:4006:4050:4008:4011:4001:4021:4022:4028:4016:4051"); AddCard(500000, "4043:4015:4052:4027:4003:4014:4012:4010:4034"); freeloop(false); end; function AddCard { .@price = getarg(0, 0); if (.@price < 1) { debugmes sprintf("[%s] AddCard: buying price is %d, minimum price is 1", strnpcinfo(0), .@price); return; } .@card_list$ = getarg(1, ""); if (.@card$ == "") { debugmes sprintf("[%s] AddCard: card list is empty for price %d", strnpcinfo(0), .@price); return; } explode(.@card$, .@card_list$, ":"); for (.@i = 0; .@i < getarraysize(.@card$); .@i++) { .@id = atoi(.@card$); if (getitemname(.@id) == "null") { debugmes sprintf("[%s] AddCard: card id %d is not exist price %d", strnpcinfo(0), .@id, .@price); continue; } .@f = inarray(.card_list, .@id); if (.@f > -1) { debugmes sprintf("[%s] AddCard: card id %d duplicate entry, first set price %d", strnpcinfo(0), .@id, .card_price[.@id]); continue; } .card_list[getarraysize(.card_list)] = .@id; .card_price[.@id] = .@price; } return; } } writing it with out testing it work or not, you can use this as sample tho.. if you want
    1 point
  2. You have a few ways of doing that. Your script doesn't cover all possible abusable ways even with logout. It is possible to cancel a script without logging out. One trick is to "abuse" the addtimer behavior. While a script is running, the timed event will not run until the current script is finished (it is queued). As for the logging out issue, you can simply use OnPCLogoutEvent. One drawback from this is that you need to delete the timer as otherwise it will revert whenever you exit the NPC. So I added another menu option to confirm your style, " ~ I want this style". I'd probably remove the " ~ Revert to original" if I were you as it's not needed at all. Cancelling will do that for you and that way you can keep 4 menu options and keep things clean. prontera,76,96,1 script Stylist#custom_stylist 122,{ setarray .@Styles[1], getbattleflag("max_cloth_color"), getbattleflag("max_hair_style"), getbattleflag("max_hair_color"); setarray .@Look[1], LOOK_CLOTHES_COLOR, LOOK_HAIR, LOOK_HAIR_COLOR; set .@s, select(" ~ Cloth color: ~ Hairstyle: ~ Hair color"); set .@Revert, getlook(.@Look[.@s]); set .@Style,1; @stylist_look_type = .@Look[.@s]; @stylist_look_value = getlook(@stylist_look_type); addtimer 1, strnpcinfo(0) + "::OnPCLogoutEvent"; while(1) { setlook .@Look[.@s], .@Style; message strcharinfo(0),"This is style #"+.@Style+"."; set .@menu$, " ~ Next (^0055FF"+((.@Style!=.@Styles[.@s])?.@Style+1:1)+"^000000): ~ Previous (^0055FF"+((.@Style!=1)?.@Style-1:.@Styles[.@s])+"^000000): ~ Jump to...: ~ I want this style"; switch(prompt(.@menu$)) { case 1: set .@Style, ((.@Style != .@Styles[.@s]) ? .@Style+1 : 1); break; case 2: set .@Style, ((.@Style != 1) ? .@Style-1 : .@Styles[.@s]); break; case 3: message strcharinfo(0),"Choose a style between 1 - "+.@Styles[.@s]+"."; input .@Style,0,.@Styles[.@s]; if (!.@Style) set .@Style, rand(1,.@Styles[.@s]); break; case 4: // You have to set the values to 0 and remove the timer event once the colors are chosen and confirmed // Your code currently doesn't have a way out of your loops, so I added this one. @stylist_look_type = @stylist_look_value = 0; deltimer strnpcinfo(0) + "::OnPCLogoutEvent"; end; default: set .@Style, .@Revert; setlook .@Look[.@s], .@Revert; end; } } end; OnPCLogoutEvent: if (@stylist_look_type != 0) { setlook @stylist_look_type, @stylist_look_value; } deltimer strnpcinfo(0) + "::OnPCLogoutEvent"; end; }
    1 point
  3. Hi, thank you for the feedback! That's something that should be fairly quick to add if something like @xVaan and @M45T3R suggested (i.e., the ability to apply an arbitrary remote patch) is added as well. I'll create an issue on github.
    1 point
  4. you have other NPC script that added the loadevent mapflag at payon map. all OnPCLoadMapEvent script should add extra map checking to avoid it trigger unnecessary event which come from other NPC scripts. It is a global event which will trigger all NPC that has this event label.
    1 point
  5. try get version 4.4, added the option to skip the SECURE_NPCTIMEOUT // ignore SECURE_NPCTIMEOUT .ignore_secure_npctimeout = 0; gender isn't a style, and there are so much gender changer in the forum.
    1 point
  6. View File @security - Prevent account transaction Features Prevent unwanted transaction for your account -well, just for safety- by using (at)security command. When transaction is blocked, a char cannot drop, sell, buy items, compound a card, put off cart, and other item-consumed activities Included FluxCP Addon to reset security code Compatibility: Updated for Git Hash: 9da3ad14 (20191016) For other version or emulator: you need to contact me first before download this file, so I can make it work for your need. By downloading/buying this source, you are agree to "I will only use this source modification for my own private server not as group, not as company, not as group of servers and never redistribute to other people even they are my close friends or my parent. If I get trouble to apply this modification or when I need someone to update, I will only contact Cydh. And I agree to get extra fee if want this modification for other emulator than rAthena or if I want to some big changes for this modification. I promise." Video: Submitter Cydh Submitted 01/01/2018 Category Source Modifications Video https://youtu.be/1M4U6-qAF9E Content Author Cydh  
    1 point
×
×
  • Create New...