/* ________________________________________________________
/ \
| | |__ _ __ / \ | |_| |__ ___ _ __ __ _ |
| | '_ \| '__/ _ \| __| '_ \ / _ \ '_ \ / _` | |
| | |_) | | / ___ \ |_| | | | __/ | | | (_| | |
| |_.__/|_|/_/ \_\__|_| |_|\___|_| |_|\__,_| |
| |
|--------------------------------------------------------|
| Nome do Script: Shoping com desconto |
|--------------------------------------------------------|
| Criado por: Sephir4 |
|--------------------------------------------------------|
\________________________________________________________/*/
prontera,158,180,5 script Shopping de Cartas 1_M_SIGNMCNT,{
query_sql "SELECT `value` FROM `acc_reg_num_db` WHERE `key`='#CASHPOINTS' AND `account_id` = '"+getcharid(3)+"'",.@VCash;
mes "[^539dc5Shopping de Cartas^000000]";
mes "Olá ^FF0000"+strcharinfo(0)+"^000000, Seja bem vindo!";
mes " ";
mes "Você atualmente possui ^0000FF"+.@VCash+"^000000 Cash";
mes " ";
mes "A Loja está com: ^0000FF"+$dcartas+"%^000000 de descontos para os VIP Plus.";
close2;
callshop "Shop01",1;
npcshopattach "Shop01";
end;
OnBuyItem:
for(set @i,0; @i < getarraysize(.item);set @i,@i+1){
if(@bought_nameid == .item[@i]){
mes .n$;
set @val, @bought_quantity*.custo[@i];
mes "Valor sem desconto: [^9B30FF"+@val+"^000000] Cash.";
if(getgroupid() > 2)set @calc, $dcartas*(@val/100); else set @calc, @val;
mes "Valor com desconto: [^228B22"+(@val-@calc)+"^000000] Cash.";
mes "Desconto VIP Plus: [^FF0000"+$dcartas+"%^000000]";
mes " ";
mes "Deseja mesmo comprar esse item?";
if(select("Sim","Não") == 2) close;
if(#CASHPOINTS >= (@val-@calc)){
mes "[^00FF00Compra bem sucedida^000000]";
mes "";
mes @bought_quantity+"x - "+getitemname(@bought_nameid);
getitem .item[@i],@bought_quantity;
set #CASHPOINTS,#CASHPOINTS-(@val-@calc);
close;
}
mes "[^FF0000Voê não possui cash suficiente.^000000]";
close;
}
}
mes "[^FF0000Algo está errado, entre em contato com a equipe de Administração.^000000]";
close;
end;
OnCalcDesconto:
set $dcartas, .@atcmd_parameters$[0];
dispbottom "Todos os itens do [Shopping de Cartas] terão um desconto de "+.@atcmd_parameters$[0]+"% para jogadores VIP Plus.";
end;
OnInit:
set .n$,"[^539dc5Shopping de Cartas^000000]";
npcshopdelitem "Shop01", 503;
set $dcartas, 0;
unbindatcmd "dcartas";
setarray .item[0], 4132,4143,4148,4169,4198,4241,4330,4372,4374,4403,4047,4054,4135,4302,4324,4342,4363,4386,4408,4419,4121,4134,4137,4142,4147,4263,4276,4305,4318,4367,4425,4146,4174,4123,4131,4168,4236,4290,4352,4376,4441,4144,4145,4384,4430,4399,4407,4361,4357,4359,4363,4365,4367,4128;
setarray .custo[0], 500,500,500,500,500,500,500,500,500,500,500,500,500,500,500,500,500,500,500,500,500,500,500,500,500,500,500,500,500,500,500,500,500,500,500,500,500,500,500,500,500,500,500,500,500,500,500,500,500,500,500,500,500,500;
for(set .x,0; .x < getarraysize(.item); set .x,.x+1) npcshopadditem "Shop01", .item[.x],.custo[.x];
bindatcmd("dcartas","Shopping de Cartas::OnCalcDesconto",99,99);
end;
}
- shop Shop01 -1,503:500