Thread: removeweapon()
View Single Post
  #5  
Old 07-07-2008, 11:15 PM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
When you call player.removeweapon() then its modifying player.weapons[], that's why the loop is only removing 14. Possible solution would be

PHP Code:
for (i=player.weapons.size()-1i>=0i--)
  
player.removeweapon(player.weapons[i].name); 
(might be confusing but player.weapons is a special intelligent object which lets you print the player weapon list as string even when there are weapons which don't really exist, and by using weapons[] you can still directly access the weapon npc)
Reply With Quote