JASHI11 Posted Saturday at 07:18 PM Posted Saturday at 07:18 PM (edited) necesito 2 npc - cash y otro zeny - como puedo crear shop a este npc ?? es rental item npc - el item que necesito que rente es id 5000 lo quiero con las 3 opciones: 1 día de renta, 1 semana renta, 1mes de renta. rental_item.txt Edited Saturday at 07:22 PM by JASHI11 olvide colocar algo importante Quote
0 Racaae Posted 17 hours ago Posted 17 hours ago I modified the file for you. - script atcmd_example -1,{ OnAtcommand: .@itemid = atoi(.@atcmd_parameters$[0]); .@refine = atoi(.@atcmd_parameters$[1]); .@card1 = atoi(.@atcmd_parameters$[2]); .@card2 = atoi(.@atcmd_parameters$[3]); .@card3 = atoi(.@atcmd_parameters$[4]); .@card4 = atoi(.@atcmd_parameters$[5]); if (getitemname(.@itemid) != "null") { if (getiteminfo(.@itemid, 2) != IT_CARD && (!.allowed_items[0] || inarray(.allowed_items, .@itemid) != -1)) { for( .@i = 0; .@i < getarraysize( .rent_time ); .@i++ ) { .@s_count = 0; if (.cost_cash[.@i]) .@s$[.@s_count++] = F_InsertComma(.cost_cash[.@i]) + " CASH"; if (.cost_item_id && .cost_item_amt[.@i]) { .@payment_option = 1; .@s$[.@s_count++] = .cost_item_amt[.@i]+"x " + getitemname( .cost_item_id ); } if (.cost_zeny[.@i]) { .@payment_option = 2; .@s$[.@s_count++] = F_InsertComma(.cost_zeny[.@i]) + "z"; } if (getarraysize(.@s$) == 1) .@s2$ = " ^0000FF[" + .@s$[0] + "]^000000"; .@menu$ += "Rent for " + .rent_time[.@i] + " day" + (.rent_time[.@i]>1?"s":"") + .@s2$ + ":"); } .@i = select(.@menu$) - 1; if (.@s_count > 1) { message strcharinfo(0), "Renting " + getitemname(.@itemid) + ". Choose the Payment option."; if (.cost_cash[.@i]) .@t1$ = "Pay " + F_InsertComma(.cost_cash[.@i]) + " CASH"; if (.cost_item_id && .cost_item_amt[.@i]) .@t2$ = "Pay " + .cost_item_amt[.@i]+"x " + getitemname( .cost_item_id ); if (.cost_zeny[.@i]) .@t3$ = "Pay " + F_InsertComma(.cost_zeny[.@i]) + "z"; if (select("Cancel", .@t1$, .@t2$, .@t3$) == 1) end; .@payment_option = @menu - 2; } switch(.@payment_option) { case 0: if ( #CASHPOINTS < .cost_cash[.@i] ) { dispbottom "You don't have enough CASH."; end; } #CASHPOINTS -= .cost_cash[.@i]; break; case 1: if ( countitem( .cost_item_id ) < .cost_item_amt[.@i] ) { dispbottom getitemname( .cost_item_id ) + " is insufficient."; end; } delitem .cost_item_id, .cost_item_amt[.@i]; break; case 2: if ( Zeny < .cost_zeny[.@i] ) { dispbottom "You don't have enough Zeny."; end; } Zeny -= .cost_zeny[.@i]; break; } rentitem2 .@itemid, .rent_time[.@i] * 86400,1,.@refine,0,.@card1,.@card2,.@card3,.@card4; } else { dispbottom .@atcmd_command$+" - You cant rent "+getitemname(.@itemid); } } else { dispbottom .@atcmd_command$+" - invalid item #"+.@itemid; } end; OnInit: //== SETTINGS ================== setarray .allowed_items,5000; setarray .rent_time,1,7,30; //rent time options in days setarray .cost_cash,100,600,1500; //Cost in Cash for each option - comment (//) to disable setarray .cost_zeny,10000000,15000000,30000000; //Cost in Zeny for each option - comment (//) to disable //.cost_item_id = 7929; //ID of the item used for exchange - comment (//) to disable setarray .cost_item_amt,3,5,10; //Cost (in item) for each time option - comment (//) to disable //=================================== bindatcmd("rentitem", strnpcinfo(3)+"::OnAtcommand"); if (.cost_item_id && .cost_item_amt[0] && getitemname(.cost_item_id) == "null") { errormes "Invalid Item ID for rental cost shop. Skipping."; deletearray .cost_item_amt, getarraysize(.cost_item_amt); } end; } SPA: Spoiler Configuración flexible por arrays setarray .rent_time,1,7,30; setarray .cost_cash,100,600,1500; setarray .cost_zeny,10000000,15000000,30000000; Los arrays .rent_time, .cost_cash y .cost_zeny están sincronizados por índice. Por ejemplo, .rent_time[1] = 7 días, con .cost_cash[1] = 600 y .cost_zeny[1] = 15,000,000 Esto permite añadir/remover planes de renta fácilmente. Construcción del menú dinámico for (.@i = 0; .@i < getarraysize(.rent_time); .@i++) { .@s$[.@s_count++] = F_InsertComma(.cost_cash[.@i]) + " CASH"; ... .@menu$ += "Rent for " + .rent_time[.@i] + " day(s)..."; } Se genera el menú de opciones en tiempo real según la configuración. También detecta si hay múltiples formas de pago para mostrar un submenú. Manejo de pagos switch(.@payment_option) { case 0: // CASH case 1: // ITEM case 2: // ZENY El sistema permite múltiples métodos de pago por opción de renta. Usa #CASHPOINTS, countitem y Zeny según el caso. Si el jugador no tiene suficiente, muestra el motivo y termina. Quote
Question
JASHI11
necesito 2 npc - cash y otro zeny
- como puedo crear shop a este npc ?? es rental item npc
- el item que necesito que rente es id 5000 lo quiero con las 3 opciones: 1 día de renta, 1 semana renta, 1mes de renta.
rental_item.txt
Edited by JASHI11olvide colocar algo importante
1 answer 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.