View Single Post
  #10  
Old 07-27-2007, 03:45 AM
Strake
Sarnak
 
Join Date: Jul 2007
Posts: 37
Default

Okay, before I compile it and break everything, does this look good to everyone else?
(Reminder: I'm trying to allow #summonitem with augments and items with charges while not allowing people to stack item stats. I figured, since 100 is the max number of charges, and 1001 is the lowest item number, there's no chance of item stacking)

Code:
void command_summonitem(Client *c, const Seperator *sep)
{
	if (!sep->IsNumber(1))
		c->Message(0, "Usage: #summonitem [item id] [charges], charges are optional");
	else {
		int32 itemid = atoi(sep->arg[1]);
		if (database.GetItemStatus(itemid) > c->Admin())
			c->Message(13, "Error: Insufficient status to summon this item.");
		else if (sep->argnum==2 && sep->IsNumber(2)) {
			const Item_Struct* itm = database.GetItem(itemid);
			if(itm){
				if(itm->AugType == 0 || atoi(sep->arg[2]) > 100){
					c->SummonItem(itemid);
				}
				else
				{
					c->SummonItem(itemid, atoi(sep->arg[2]) );
				}
			}
		else {
			c->SummonItem(itemid);
		}
	}
}
-Dillon
Reply With Quote