Test in SQL
if(!countitem(7420))end;
query_sql("SELECT `amount`,`id` FROM `storage` WHERE (`account_id` = "+getcharid(3)+"&&`nameid`=7420)",.@a,.@id);
if(.@a==0)
query_sql "INSERT `storage` VALUES ( NULL,"+getcharid(3)+",7420,"+countitem(7420)+",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)";
else
query_sql "UPDATE `storage` set amount = "+(.@a+countitem(7420))+" where id = "+.@id;
delitem 7420,countitem(7420);