I already have the custom char code and table from drajor, and I compiled your code into mine and it all works..
When trade is denied, the proper IDS are echoed.. I tried first with different expansion settings for both chars, and it gave me the Denied message as expected, then i made both chars expansion values equal in the db and trade went through, no crash.. Nice work on this...
Code:
if (database.RunQuery(query, MakeAnyLenString(&query, "SELECT expansion FROM character_vars WHERE character_vars.character_id=%i", myID), errbuf, &result)) {
AND
if (database.RunQuery(query, MakeAnyLenString(&query, "SELECT expansion FROM character_vars WHERE character_vars.character_id=%i", tID), errbuf, &result)) {
AND for giggles
if (myExpansion != tradeeExpansion)
{
Message(13, "Trade denied.");
Message(13, "Value of myID is %i", myID);
Message(13, "Value of tID is %i", tID);
return;
}
Message(13, "Yes!! And it counts.");
tradee->CastToClient()->QueuePacket(app);
}