PDA

View Full Version : Magelo modification


aza77
10-05-2006, 05:49 AM
This patch makes it possible to enable or disable the magelo for an account. #magelo enable/disable is the command for it.

First of all you need to modify the account table:

ALTER TABLE `account` ADD `magelo` TINYINT( 1 ) UNSIGNED NOT NULL DEFAULT '1';

magelo 1 = enabled
magelo 0 = disabled

if you want it disabled by default just change the default 1 to 0.

now we need to add the command for it ..

command.cpp
-------------

||
command_add("magelo","- enable/disable your mageloprofile",0,command_magelo)

-------------

void command_magelo(Client *c, const Seperator *sep)
{
if (strcasecmp(sep->arg[1], "enable")==0)
{
database.SetMagelo(c->AccountID(),1);
c->Message(0, "Your Magelo profile is enabled.");
}
else if (strcasecmp(sep->arg[1], "disable")==0)
{
database.SetMagelo(c->AccountID(),0);
c->Message(0, "Your Magelo profile is disabled.");
}
else
c->Message(0, "Usage: #magelo [enable/disable]");
}

------------

command.h
------------

void command_magelo(Client *c, const Seperator *sep);

------------

database.cpp
------------

void Database::SetMagelo(int32 acctid, int8 status)
{
char errbuf[MYSQL_ERRMSG_SIZE];
char *query = 0;
int32 affected_rows = 0;

RunQuery(query, MakeAnyLenString(&query, "UPDATE account SET magelo=%i where id=%i",status,acctid), errbuf, 0, &affected_rows);
safe_delete_array(query);
}

------------

database.h
------------

void SetMagelo(int32 acctid, int8 status);

------------

now the final step .. get the modified magelo from www.projectf.org/downloads/magelo.zip and install it

enjoy it ;)