Thread: DR3 bugs
View Single Post
  #7  
Old 05-19-2004, 06:31 AM
m0oni9
Hill Giant
 
Join Date: Dec 2003
Posts: 166
Default

Try these out. Should be in command.cpp at about lines 2938 and 1411 in command.cpp, respectively.

Code:
void command_listpetition (Client *c, const Seperator *sep)
{
  char errbuf[MYSQL_ERRMSG_SIZE];
  char *query;
  MYSQL_RES *result;
  MYSQL_ROW row;
  unsigned int count = 0;

  query = new char[256];

  if (database.RunQuery (
    query,
    MakeAnyLenString(&query,  "SELECT petid, charname,accountname FROM petitions ORDER BY petid"),
    errbuf,
    &result) == false)
  {
    safe_delete_array (query);
    c->Message (13, "Error executing query.");
    return;
  }

  safe_delete_array (query);

  LogFile->write (EQEMuLog::Normal,
    "Petition list requested by %s", c->GetName());

  while ((row = mysql_fetch_row (result)) != NULL)
  {
    if (count++ == 0)
      c->Message (13,"  ID: Character Name, Account Name");

    c->Message (15, "  %s: %s, %s", row[0], row[1], row[2]);
  }

  if (count == 0)
    c->Message (15, "No petitions found.");

  mysql_free_result (result);
}
Code:
void command_delpetition (Client *c, const Seperator *sep)
{
   if (sep->arg[1][0] == 0 || strcasecmp (sep->arg[1], "*") == 0)
   {
      c->Message (0, "Usage: #delpetition (petition number).");
      c->Message (0, "Type #listpetition for a list.");
      return;
   }

   if (petition_list.DeletePetition (atoi (sep->argplus[1])) == -1)
      c->Message (13, "Error deleting petition %i.", atoi (sep->argplus[1]));
   else
      c->Message (13, "Deleted petition %i.", atoi(sep->argplus[1]));
}
edit: Added new delete petition function and modified list petitions.
Reply With Quote