Перейти к содержанию

Нпс магазин


Рекомендуемые сообщения

prontera,115,175,6	script	Dynamic Shop	437,{
mes .name$;
mes "You currently have "+countitem(.ItemNeeded)+" "+getitemname(.ItemNeeded)+".";
mes "Would you like to look at the shop?";
next;
if(select("Yes:No") == 2) {
close;
}
close2;
callshop "dy_shop",1;
npcshopattach "dy_shop";
dispbottom "You currently have "+countitem(.ItemNeeded)+" "+getitemname(.ItemNeeded)+".";
end;

OnBuyItem:
for(set @i,0; @i < getarraysize(@bought_nameid); set @i,@i+1) {
for(set @j,0; @j < getarraysize(.ItemNeededS); set @j,@j+2) {
if(.ItemNeededS[@j] == @bought_nameid[@i]) {
set @itemcost,(.ItemNeededS[(@j+1)]*@bought_quantity[@i]);
set @totalcost,(@totalcost+@itemcost);
break;
}
}
}
if(@totalcost > countitem(.ItemNeeded)) {
message strcharinfo(0), "You don't have enough "+getitemname(.ItemNeeded)+"";
end;

}
else {
for(set @i,0; @i < getarraysize(@bought_nameid); set @i,@i+1) {
getitem @bought_nameid[@i],@bought_quantity[@i];
}
delitem .ItemNeeded,@totalcost;
dispbottom "Thank you for shopping.";
dispbottom "You now have "+countitem(.ItemNeeded)+" "+getitemname(.ItemNeeded)+".";
}
set @totalcost,0;
deletearray @bought_nameid[0],128;
deletearray @bought_quantity[0],128;
end;

OnInit:
npcshopdelitem "dy_shop",909; // Leave this alone
set .name$,"[Dynamic Shop]";
set .ItemNeeded,7227;
setarray .ItemNeededS[0],607,1,608,2,512,3,7539,1;


for(set .@i,0; .@i < getarraysize(.ItemNeededS); set .@i,.@i+2) {
npcshopadditem "dy_shop",.ItemNeededS[.@i],.ItemNeededS[(.@i+1)];
}
}

- shop dy_shop 139,909:1

Редактируем shop list здесь

setarray .ItemNeededS[0],607,1,608,2,512,3,7539,1;
//setarray .ItemNeededS[0],<Item 1>,<Amount>,<Item 2>,<Amount>.....;

Редактируем вещь которая нам нужна для покупки вещей здесь.

set .ItemNeeded,7539;

Меняете айди 7539 на айди которое вам нужно

Источник

  • Upvote 4
Ссылка на комментарий
Поделиться на другие сайты

prontera,115,175,6	script	Dynamic Shop	437,{
mes .name$;
mes "You currently have "+countitem(.ItemNeeded)+" "+getitemname(.ItemNeeded)+".";
mes "Would you like to look at the shop?";
next;
if(select("Yes:No") == 2) {
close;
}
close2;
callshop "dy_shop",1;
npcshopattach "dy_shop";
dispbottom "You currently have "+countitem(.ItemNeeded)+" "+getitemname(.ItemNeeded)+".";
end;

OnBuyItem:
for(set @i,0; @i < getarraysize(@bought_nameid); set @i,@i+1) {
for(set @j,0; @j < getarraysize(.ItemNeededS); set @j,@j+2) {
if(.ItemNeededS[@j] == @bought_nameid[@i]) {
set @itemcost,(.ItemNeededS[(@j+1)]*@bought_quantity[@i]);
set @totalcost,(@totalcost+@itemcost);
break;
}
}
}
if(@totalcost > countitem(.ItemNeeded)) {
message strcharinfo(0), "You don't have enough "+getitemname(.ItemNeeded)+"";
end;

}
else {
for(set @i,0; @i < getarraysize(@bought_nameid); set @i,@i+1) {
getitem @bought_nameid[@i],@bought_quantity[@i];
}
delitem .ItemNeeded,@totalcost;
dispbottom "Thank you for shopping.";
dispbottom "You now have "+countitem(.ItemNeeded)+" "+getitemname(.ItemNeeded)+".";
}
set @totalcost,0;
deletearray @bought_nameid[0],128;
deletearray @bought_quantity[0],128;
end;

OnInit:
npcshopdelitem "dy_shop",909; // Leave this alone
set .name$,"[Dynamic Shop]";
set .ItemNeeded,7227;
setarray .ItemNeededS[0],607,1,608,2,512,3,7539,1;


for(set .@i,0; .@i < getarraysize(.ItemNeededS); set .@i,.@i+2) {
npcshopadditem "dy_shop",.ItemNeededS[.@i],.ItemNeededS[(.@i+1)];
}
}

- shop dy_shop 139,909:1

Редактируем shop list здесь

setarray .ItemNeededS[0],607,1,608,2,512,3,7539,1;
//setarray .ItemNeededS[0],<Item 1>,<Amount>,<Item 2>,<Amount>.....;

Редактируем вещь которая нам нужна для покупки вещей здесь.

set .ItemNeeded,7539;

Меняете айди 7539 на айди которое вам нужно

Источник

Хмм интересно установил я это Dynamic Shop. И не понимаю для чего это строчка:

-	shop	dy_shop	139,909:1

Мап сервер ругается:

[Warning]: npc_parse_shop: Item Jellopy [909] discounted buying price (1->0) is

less than overcharged selling price (3->3) at file 'npc/custom/homero/shop.txt',

line '94'.

Ссылка на комментарий
Поделиться на другие сайты

МАП сервер какбы намекает что цена продажи не соответствует цене покупки, то есть сравни цены и учти что можно покупать со скидкой.

Изменено пользователем PhoeniX
  • Upvote 1
Ссылка на комментарий
Поделиться на другие сайты

  • 1 год спустя...

МАП сервер какбы намекает что цена продажи не соответствует цене покупки, то есть сравни цены и учти что можно покупать со скидкой.

ностальгия) помнится на моем первом сервере я такую цену поставил. ребята wpe-шили с прибылью в 100 зен себе хорошие деньги)

Изменено пользователем Sanasol
помниться =)
  • Upvote 1
Ссылка на комментарий
Поделиться на другие сайты

  • 4 месяца спустя...


// Settings :
// - Only required to edit the ShopSetting() Function
// Notes : You may also add / remove Menu ( If any )
// - Shop Currency can be either ItemID or Variable Name, but must write within Quotation Marks ( "" )
// Ex. of Variable. -> Zeny , #CASHPOINTS , #KAFRAPOINTS , CustomVariable , #CustomVariable
// - ERROR Message are used to show Invalid Settings in your NPC.


// Leave this alone...
- shop Emistry_Shop -1,512:100


job_star,29,31,5 script Берёзка 751,{
function ShopSettings;
function ValidateCost;
function CurrencyInfo;
function ClearData;
function ValueConvert;
function ErrorNotice;

mes "Магазины за разные Валюты^000000.";
mes "^00FF00____________________________^000000";
mes "За что будем покупать";
next;
// Menu Selection
select("Магазин за PoD","Магазин за TCG Card","Магазин за VB","Магазин за кешпоинты");

ClearData();
ShopSettings( @menu );
npcshopitem "Emistry_Shop",512,100;
npcshopdelitem "Emistry_Shop",512;
for(set .@i,0; .@i < getarraysize( @ItemLists ); set .@i,.@i+1)
npcshopadditem "Emistry_Shop",@ItemLists[.@i],@ItemCost[.@i];
mes "Выбирайте товар";
mes "^00FF00____________________________^000000";
CurrencyInfo( @Currency$ );
mes "^00FF00____________________________^000000";
callshop "Emistry_Shop",1;
npcshopattach "Emistry_Shop";
end;


function ShopSettings {
switch( getarg(0) ){
Case 1:
// Currency [ Item ID / Variable Name ]
set @Currency$,"7179";
// Item ID Lists
setarray @ItemLists[0],2306,7227;
// Item Price
setarray @ItemCost[0],1,1;
break;
Case 2:
// Currency [ Item ID / Variable Name ]
set @Currency$,"7227";
// Item ID Lists
setarray @ItemLists[0],20166,20167,20168,20169,20170,20171;
// Item Price
setarray @ItemCost[0],20,20,20,20,20,20;
break;
Case 3:
// Currency [ Item ID / Variable Name ]
set @Currency$,"7829";
// Item ID Lists
setarray @ItemLists[0],20166,20167,20168,20169,20170,20171;
// Item Price
setarray @ItemCost[0],20,20,20,20,20,20;
break;
Case 4:
// Currency [ Item ID / Variable Name ]
set @Currency$,"#CASHPOINTS";
// Item ID Lists
setarray @ItemLists[0],2306,2302,2303,2304,2305,2301;
// Item Price
setarray @ItemCost[0],20,22,34,445,52,641;
break;
// Case 4,5,6.....etc...
default:
ErrorNotice( "Invalid Menu Selection for Menu "+@menu+"." );
close;
}


if( @Currency$ == "" )
ErrorNotice( "Invalid Currency Setting in Menu "+@menu+" ." );
if( getarraysize( @ItemCost ) != getarraysize( @ItemLists ) || getarraysize( @ItemLists ) != getarraysize( @ItemCost ) )
ErrorNotice( "Missing or Extra Value of Item or Cost Settings in Menu "+@menu+" ." );
return;
}

function ErrorNotice {
mes "^FF0000Ошибка^000000 - "+getarg(0);
mes "^00FF00____________________________^000000";
mes "Inform this Message to ^0000FFGame Staffs^000000 immediately !";
close;
}

function CurrencyInfo {
if( getitemname( atoi( getarg(0) ) ) != "null" ){
mes "Валюта : ^FF0000"+getitemname( atoi( getarg(0) ) )+"^000000";
mes "у вас есть : ^0000FF"+ValueConvert( countitem( atoi( getarg(0) ) ) )+"^000000 валюты";
}else if( getitemname( atoi( getarg(0) ) ) == "null" ){
mes "Variable Currency : ^FF0000"+getarg(0)+"^000000";
mes "Available Amount : ^0000FF"+ValueConvert( getd( getarg(0) ) )+"^000000";
}
return;
}

function ValidateCost {
if( getitemname( atoi( getarg(0) ) ) != "null" ){
if( countitem( atoi( getarg(0) ) ) < getarg(1) ) return 1;
}else{
if( getd( getarg(0) ) < getarg(1) ) return 1;
}
return 0;
}

function ClearData {
set @Currency$,"";
set @TotalCost,0;
deletearray @bought_nameid[0],getarraysize( @bought_nameid );
deletearray @bought_quantity[0],getarraysize( @bought_quantity );
deletearray @ItemLists[0],getarraysize( @ItemLists );
deletearray @ItemCost[0],getarraysize( @ItemCost );
return;
}

function ValueConvert {
set .@num, atoi(""+getarg(0));
if ( .@num == 0 || .@num >= 2147483647 ) return getarg(0);
set .@l, getstrlen(""+.@num);
for ( set .@i,0; .@i < .@l; set .@i, .@i + 1 ) {
set .@num$, .@num % pow(10,.@i+1) / pow(10,.@i) + .@num$;
if ( (.@i+1) % 3 == 0 && .@i+1 != .@l ) set .@num$, ","+ .@num$;
}
return .@num$;
}

OnBuyItem:
ShopSettings( @menu );
for(set @i,0; @i < getarraysize( @bought_nameid ); set @i,@i+1)
for(set @j,0; @j < getarraysize( @ItemLists ); set @j,@j+1)
if( @ItemLists[@j] == @bought_nameid[@i] )
set @TotalCost,@TotalCost + ( @ItemCost[@j] * @bought_quantity[@i] );
mes "^FF0000 ЛИСТ ПОКУПОК^000000";
mes "^00FF00____________________________^000000";
for( set @i,0; @i < getarraysize( @bought_nameid ); set @i,@i+1 )
mes "^FF0000"+@bought_quantity[@i]+" x ^0000FF"+getitemname( @bought_nameid[@i] )+"^000000";
mes "^00FF00____________________________^000000";

if( getitemname( atoi( @Currency$ ) ) != "null" )
mes "Вам нужно оплатить : ^0000FF"+ValueConvert( @TotalCost )+" x "+getitemname( atoi( @Currency$ ) )+"^000000";
else if( getitemname( atoi( @Currency$ ) ) == "null" ){
mes "Total Cost : ^0000FF"+ValueConvert( @TotalCost )+" "+@Currency$+"^000000";
}

mes "^00FF00____________________________^000000";
if( ValidateCost( @Currency$,@TotalCost ) ){
if( getitemname( atoi( @Currency$ ) ) != "null" )
mes "[ ^FF0000X^000000 ]У Вас недостаточно ^0000FF"+getitemname( atoi( @Currency$ ) )+"^000000";
else{
mes "[ ^FF0000X^000000 ] У Вас недостаточно ^0000FF"+@Currency$+"^000000";
}
}else{
if( select( "^0000FFКупить^000000:Cancel" ) == 1 ){
if( getitemname( atoi( @Currency$ ) ) != "null" )
delitem atoi( @Currency$ ),@TotalCost;
else{
set getd( @Currency$ ),getd( @Currency$ ) - @TotalCost;
}
for(set @i,0; @i < getarraysize( @bought_nameid ); set @i,@i+1)
getitem @bought_nameid[@i],@bought_quantity[@i];
message strcharinfo(0),"Пуплено "+getarraysize( @bought_nameid )+" вещей.";
mes "Спасибо за покупку.";
}
}
ClearData();
close;

}

Вот другой магазин!

  • Upvote 2
Ссылка на комментарий
Поделиться на другие сайты

×
×
  • Создать...
Яндекс.Метрика