Hello, I use this npc that give loyalty points to use in the store, but sometimes people can buy the items even without points, I would like to know where the problem is
- script Fidelidade -1,{
OnPCLoginEvent:
addtimer 60000,"Fidelidade::OnTime";
end;
OnTime:
if(query_sql("SELECT login.account_id FROM login LEFT JOIN `char` ON login.account_id=`char`.account_id WHERE login.last_ip=(SELECT last_ip FROM login WHERE account_id="+getcharid(3)+") AND `char`.online=1", .@account_id) > 2){ end; }
if(checkvending() || #fidelidade == 30000){ end; }
set #fidelidade,#fidelidade + 1;
if(#fidelidadeon == 0){ dispbottom "@fidelidade : Você recebeu 1 Ponto e ficou com "+#fidelidade+" Pontos de Fidelidade, use @fidelidade."; }
addtimer 60000,"Fidelidade::OnTime";
end;
OnInit:
bindatcmd "fidelidade","Fidelidade::OnFIDELIDADE";
setarray .ItList[0],7836,2700,6001,2700,7087,2700,12080,540,7443,540,675,360,31349,18000,31350,18000,20301,14400,18247,14400,31382,19800,31380,19800,31381,19800;
npcshopdelitem "DynShop02",501;
for(set .n,0;.n<getarraysize(.ItList);set .n,.n+2)
npcshopadditem "DynShop02",.ItList[.n],.ItList[(.n+1)];
end;
OnBuyItem:
for(set @n,0;@n<getarraysize(@bought_nameid);set @n,@n+1)
for(set @a,0;@a<getarraysize(.ItList);set @a,@a+2)
if(@bought_nameid[@n]==.ItList[@a]){
set @PriceT,.ItList[@a+1]*@bought_quantity[@n];
if(#fidelidade){ if(#fidelidade<@PriceT) end; }else{ if(Zeny<@PriceT) end; }
getitem @bought_nameid[@n],@bought_quantity[@n];
if(#fidelidade) set #fidelidade,#fidelidade-@PriceT; else set Zeny,Zeny-@PriceT;
}
end;
OnFIDELIDADE:
mes "[^ff0000 "+strnpcinfo(1)+" ^000000]";
mes "A cada minuto conectado você recebe ^0000ff1 Ponto^000000 e juntando poderá troca-los por itens em ^FF9900Trocas da Fidelidade^000000.";
mes "^F7F7F7-^000000";
mes "Você tem ^0000ff"+#fidelidade+" Pontos de Fidelidade^000000";
switch(select((#fidelidadeon==1?"- Ligar Mensagens":"- Desligar Mensagens"),"- Trocas da Fidelidade")){
case 1:
next;
mes "[^ff0000 "+strnpcinfo(1)+" ^000000]";
if(#fidelidadeon == 0){ mes "As mensagens foram desligadas."; set #fidelidadeon,1; close; } else { mes "As mensagens foram ligadas."; set #fidelidadeon,0; close; }
case 2:
close2;
callshop "DynShop02",1;
npcshopattach "DynShop02";
end;
}
}
- shop DynShop02 -1,501:-1
Question
Scofield
Hello, I use this npc that give loyalty points to use in the store, but sometimes people can buy the items even without points, I would like to know where the problem is
Link to comment
Share on other sites
6 answers 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.