Ban Spells

How to make a command to ban spells? I know that it is possible to make it in the DB but i’d really like to know how to make a command that does that.

Thank you! /emoticons/default_smile.png

Make a macro.

What do you mean?

What? …

@Thatguy986, you can’t do it through commands and probably it will never be implemented either… Makes no sense at all.

I made this… is it any close?

bool ChatHandler::HandleBanSpellCommand(ChatHandler* handler, const char* args)


	    if (!*args)

		    return false;

  WorldDatabase.PExecute("INSERT INTO disables VALUES ('%a', '%u', '%b')", 0, args, 1);

  handler->PSendSysMessage("Spell disabled");

  return true;


When i use the command i get a SQL error

Try like this :

WorldDatabase.PExecute(“INSERT INTO disables VALUES (‘0’, ‘%u’, ‘1’)”, (char*)args);

but. not so shure it will work xD

For any value i use, it inserts into DB this number: 907277754

Why does this happens? /emoticons/default_blink.png

i give up please close this topic.

I’m apologize, Thatguy986. I didn’t realize what you asked. Sorry.

Coz u need to convert char into int if you wanna use it like that.

This works?

bool ChatHandler::HandleBanSpellCommand(const char *args)


	if (!*args)

		return false;

	WorldDatabase.PExecute("INSERT INTO disables VALUES ('0', '%u', '1')", int(args));


	return true;


With :


You will have the equivalent in decimale of your string, not the value.

You should use :


atoi() → Array To Int function.

Next, in your SQL request, replace the ‘%u’ by ‘%d’.

Your value is an int, not an unsigned.