Code:
getinventorylist();
for ( .@i = 0; .@i < @inventorylist_count; .@i++ ) {
setarray .@IdList[.@i],@inventorylist_id[.@i];
}
For above code how would I remove duplicates item ID or extract only Unique Item ID within array of .@idList so the end result would be array with no duplicated item id in it?
=================================================================================================================================================
Peace dividing line!
=================================================================================================================================================
Code:
[Error]: buildin_countitem: Invalid item '0'.
[Debug]: Source (NPC): Mass Junk Seller at prontera (164,175)
[Error]: buildin_countitem: Invalid item '0'.
[Debug]: Source (NPC): Mass Junk Seller at prontera (164,175)
[Error]: buildin_countitem: Invalid item '0'.
[Debug]: Source (NPC): Mass Junk Seller at prontera (164,175)
Above Error always happens whenever this part of function runs what can be done with it ?
but server and client runs fine.
Function \\// Down here:
Code:
function script F_SellEquips {
setarray(.@noSell0x[0], 1231, 969, 4001 );
getinventorylist();
for ( set .@i,0; .@i < @inventorylist_count; set .@i,.@i + 1) {
if ( ( getiteminfo(@inventorylist_id[.@i],ITEMINFO_TYPE) == IT_WEAPON ) || ( getiteminfo(@inventorylist_id[.@i],ITEMINFO_TYPE) == IT_ARMOR ) ) && ( @inventorylist_equip[.@i] == 0 ) && ( @inventorylist_refine[.@i] == 0 ) && ( @inventorylist_card1[.@i] == 0 ) && ( @inventorylist_card2[.@i] == 0 ) && ( @inventorylist_card3[.@i] == 0 ) && ( @inventorylist_card4[.@i] == 0 ) {
.@FinishCheck = 0;
for( .@c = 0; .@c < getarraysize(.@noSell0x); ++.@c ) {
if ( @inventorylist_id[.@i] == .@noSell0x[.@c] ) { // Yes to sell
.@FinishCheck++;
}
}
if ( .@FinishCheck == 0 ) {
setarray .@sellid[getarraysize(.@sellid)],@inventorylist_id[.@i];
}
}
}
.@sellarraysize = getarraysize(.@sellid);
.@xTItemCount = 0;
.@xTItemZeny = 0;
.@over = getskilllv("MC_OVERCHARGE");
if(.@over > 0)
.@plus = 5 + 2*.@over - .@over/10;
message strcharinfo(0),( " Sell array size " + .@sellarraysize );
if ( .@sellarraysize > 0) {
.@i = 0;
while (.@i <= .@sellarraysize) {
.@SitemID = .@sellid[.@i];
if ( ( .@sellid[.@i] != 0 ) && ( .@sellid[.@i] > 0 ) && ( countitem(.@sellid[.@i] ) > 0 ) ) {
.@SitemName$ = getitemname(.@sellid[.@i]);
.@SitemCount = countitem(.@sellid[.@i]);
.@SitemPrice = ( getiteminfo(.@sellid[.@i],1) * (100 + .@plus) / 100 ) ;
.@xTItemZeny = .@xTItemZeny + ( .@SitemPrice * .@SitemCount ) ;
.@xTItemCount = .@xTItemCount + .@SitemCount;
dispbottom ("ItemCount :: " + .@SitemCount + " ItemPrice :: " + .@SitemPrice + " ItemID :: " + .@sellid[.@i] + " ItemName :: " + .@SitemName$ );
delitem2 (.@SitemID,.@SitemCount,true,0,0,0,0,0,0);
}
++.@i;
}
Zeny = Zeny + .@xTItemZeny ;
dispbottom ( " Total Zeny Gained :: " + .@xTItemZeny + " for total item sold :: " + .@xTItemCount ) ;
}
if ( .@sellarraysize == 0 ) {
dispbottom ( " Nah ! no item can be sale, you liar! " );
}
close2;
end;
}
Last edited by a moderator: