Nero Posted February 1, 2012 Posted February 1, 2012 (edited) ayothaya,151,171,3 script Drops Trader 403,{ mes .name$; mes "You currently have "+countitem(.Imagine_item)+" Mithril coin/s."; mes "Would you like to look at the shop?"; next; if(select("Yes:No") == 2) { close; } close2; callshop "Imagine_SHOP",1; npcshopattach "Imagine_SHOP"; dispbottom "You currently have "+countitem(.Imagine_item)+" Mithril coin/s."; end; OnBuyItem: for(set @i,0; @i < getarraysize(@bought_nameid); set @i,@i+1) { for(set @j,0; @j < getarraysize(.Imagine_ITEMS); set @j,@j+2) { if(.iMAGINE_ITEMS[@j] == @bought_nameid[@i]) { set @itemcost,(.IMAGINE_ITEMS[(@j+1)]*@bought_quantity[@i]); set @totalcost,(@totalcost+@itemcost); break; } } } if(@totalcost > countitem(.Imagine_item)) { dispbottom "You don't have enough coin."; } else { for(set @i,0; @i < getarraysize(@bought_nameid); set @i,@i+1) { getitem @bought_nameid[@i],@bought_quantity[@i]; } delitem .Imagine_item,@totalcost; dispbottom "Thank you for shopping."; dispbottom "You now have "+countitem(.Imagine_item)+" Mithril coin left."; } set @totalcost,0; deletearray @bought_nameid[0],128; deletearray @bought_quantity[0],128; end; OnInit: npcshopdelitem "Imagine_SHOP",909; // Leave this alone set .name$,"[DropsTrader]"; set .Imagine_item,674; // Input TCG ID setarray .Imagine_ITEMS[0],7086,2,7090,2,7091,2,7077,2,7076,2; // Input as many items as you want (item::price) for(set .@i,0; .@i < getarraysize(.IMAGINE_ITEMS); set .@i,.@i+2) { npcshopadditem "Imagine_SHOP",.IMAGINE_ITEMS[.@i],.Imagine_ITEMS[(.@i+1)]; } } - shop Imagine_SHOP 139,909:1 My server got hacked because of this script. Edited February 1, 2012 by Arcenciel Codeboxed Quote
Emistry Posted February 1, 2012 Posted February 1, 2012 Uhm..if you dont mind...next time please wrap your script using codebox.. beside, get hacked ? mind explain further how they hacked it ? i mean how you know they hacked it ? any other information ? Quote
Terces Posted February 4, 2012 Posted February 4, 2012 Well....I did find quite a few mistakes there....no wonder it didn't work very well! one thing I noticed is the price calculation: set @itemcost,(.IMAGINE_ITEMS[(@j+1)]*@bought_quantity[@i]); is the price for the item really just a multiplication of its ID? you aso had a lot of wrong variable names. I'm not too sure but I think that might have had something to do with it. I also changed the price-calculation. ayothaya,151,171,3 script Drops Trader 403,{ mes .name$; mes "You currently have "+countitem(.Imagine_item)+" Mithril coin/s."; mes "Would you like to look at the shop?"; next; if(select("Yes:No") == 1) close; close2; callshop "Imagine_SHOP",1; npcshopattach "Imagine_SHOP"; dispbottom "You currently have "+countitem(.Imagine_item)+" Mithril coin/s."; end; OnBuyItem: for(set @i,0; @i < getarraysize(@bought_nameid); set @i,@i+1) { for(set @j,0; @j < getarraysize(.IMAGINE_ITEMS); set @j,@j+2) { if(.IMAGINE_ITEMS[@j] == @bought_nameid[@i]) { set @itemcost,(getiteminfo(.IMAGINE_ITEMS[(@j+1)],1)*@bought_quantity[@i]); set @totalcost,(@totalcost+@itemcost); break; } } } if(@totalcost > countitem(.Imagine_item)) { dispbottom "You don't have enough coin."; } else { for(set @i,0; @i < getarraysize(@bought_nameid); set @i,@i+1) { getitem @bought_nameid[@i],@bought_quantity[@i]; } delitem .Imagine_item,@totalcost; dispbottom "Thank you for shopping."; dispbottom "You now have "+countitem(.Imagine_item)+" Mithril coin left."; } set @totalcost,0; deletearray @bought_nameid[0],128; deletearray @bought_quantity[0],128; end; OnInit: npcshopdelitem "Imagine_SHOP",909; // Leave this alone set .name$,"[DropsTrader]"; set .Imagine_item,674; // Input TCG ID setarray .IMAGINE_ITEMS[0],7086,2,7090,2,7091,2,7077,2,7076,2; // Input as many items as you want (item::price) for(set .@i,0; .@i < getarraysize(.IMAGINE_ITEMS); set .@i,.@i+2) { npcshopadditem "Imagine_SHOP",.IMAGINE_ITEMS[.@i],.IMAGINE_ITEMS[(.@i+1)]; } } - shop Imagine_SHOP 139,909:1 As a little sidenote: try to use more concise, descriptive variable names. Here you use ".IMAGINE_ITEMS" and "Imagine_item" for the "Imagine_SHOP".... Quote
Question
Nero
My server got hacked because of this script.
Edited by ArcencielCodeboxed
2 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.