Try below
// if you want to use card trader where you can put multiple cards if u have them in inventory then use below
prontera,150,150,6 script Sample 100,{
getinventorylist;
for (.@i = 0; .@i < @inventorylist_count; .@i++) {
if (getiteminfo(@inventorylist_id[.@i], 2) == 6) {
.@menu$ = .@menu$ + getitemname(@inventorylist_id[.@i]) + ":";
.@cards[getarraysize(.@cards)] = @inventorylist_id[.@i];
.@qt[getarraysize(.@qt)] = @inventorylist_amount[.@i];
}
}
.@i = 0;
mes "Please select 3 cards...";
while (.@i < 3) {
if (getarraysize(.@c)) {
mes "> 1x " + getitemname(.@c[.@j]);
.@j++;
}
.@s = select(.@menu$) - 1;
.@c[getarraysize(.@c)] = .@cards[.@s];
cleararray .@qt[.@s], (.@qt[.@s] < 1 ? 0 : (.@qt[.@s]-1)), 1;
if (!.@qt[.@s])
.@menu$ = replacestr(.@menu$, getitemname(.@cards[.@s]), "");
.@i++;
}
.@size = getarraysize(.@c);
mes "> 1x " + getitemname(.@c[.@j]);
next;
mes "Are you sure you want to trade these cards?";
if (select("~ Yes:~ No") & 2) end;
for (.@i = 0; .@i < .@size; .@i++)
delitem .@c[.@i], 1;
getitem rand(4001,4699), 1;
close;
}
// if you want to use distinct card trader, means even if u have 2x poring card you can only trade 1 of them use below
prontera,153,153,6 script Sample1 100,{
getinventorylist;
for (.@i = 0; .@i < @inventorylist_count; .@i++) {
if (getiteminfo(@inventorylist_id[.@i], 2) == 6) {
.@cards[getarraysize(.@cards)] = @inventorylist_id[.@i];
.@menu$ = .@menu$ + getitemname(@inventorylist_id[.@i]) + ":";
}
}
.@i = 0;
mes "Please select 3 cards...";
while (.@i < 3) {
if (getarraysize(.@c)) {
mes "> 1x " + getitemname(.@c[.@j]);
.@j++;
}
.@s = select(.@menu$) - 1;
.@c[getarraysize(.@c)] = .@cards[.@s];
.@menu$ = replacestr(.@menu$, getitemname(.@cards[.@s]), "");
.@i++;
}
.@size = getarraysize(.@c);
mes "> 1x " + getitemname(.@c[.@j]);
next;
mes "Are you sure you want to trade these cards?";
for (.@i = 0; .@i < .@size; .@i++)
mes "> " + getitemname(.@c[.@i]);
if (select("~ Yes:~ No") & 2) end;
for (.@i = 0; .@i < .@size; .@i++)
delitem .@c[.@i], 1;
getitem rand(4001,4699), 1;
close;
}