EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Archive::Development (https://www.eqemulator.org/forums/forumdisplay.php?f=621)
-   -   New Commands - updated july 7th (https://www.eqemulator.org/forums/showthread.php?t=14645)

Draupner 07-11-2004 05:46 AM

thanks Melwin

cofruben 07-16-2004 11:22 PM

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]));
        }
  }

}



All times are GMT -4. The time now is 09:46 PM.

Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.