View Single Post
  #32  
Old 07-16-2004, 11:22 PM
cofruben
Old-EQEmu Developer
 
Join Date: Oct 2002
Location: Spain
Posts: 323
Default

I'd add the message sent to client in the if,if not,you can't check if there was any error.
Code:
void command_npcrun(Client *c, const Seperator *sep) //Draupner: Set npc speed 
{ 
   if ( strcasecmp( sep->arg[1], "help" ) == 0 ) 
   { 
      c->Message(0, "Walk/Run Speed Chart:  "); 
      c->Message(4, "     (.7) Normal Walk Speed"); 
      c->Message(4, "     (1.05) 9k Mount"); 
      c->Message(4, "     (1.25) Normal Run Speed"); 
      c->Message(4, "     (1.375) Run 1"); 
      c->Message(4, "     (1.50) Run 2"); 
      c->Message(4, "     (1.625) Run 3"); 
      c->Message(4, "     (1.9375) Spirit of Wolf"); 
      c->Message(4, "     (2.675) 100k Mount"); 
      c->Message(4, "     (3.2) Max Bard Speed"); 
   } 
   else if((sep->arg[1][0] == 0 || strcasecmp(sep->arg[1],"*")==0) || ((c->GetTarget()==0) || (c->GetTarget()->IsClient()))) 
   { 
      c->Message(0, "Usage: #npcrun [run] [help]"); 
   } 
   else 
   { 
      char errbuf[MYSQL_ERRMSG_SIZE]; 
      char *query = 0; 
      
      if (database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set runspeed=%i where id=%i",atoi(sep->argplus[1]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf)){
         safe_delete_array(query);
	 c->Message(15,"NPCID %u now runs at %i",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atoi(sep->argplus[1])); 
	}
   } 

}
Reply With Quote