Quote:
Originally Posted by xellios
Ok but now question 1 is answered who can help me on question 2!
|
oops, I didn't see question 2 srry.
Hmmm, for the php side I'd just google something to use php to add something to a mysql database (or just look at how it's done in a registration page)
For the client side that part I can do.
Personally I'd put it under characters (so it's saved to their character, not an individual table just for donation)
Add a field to character database calling it what you want, for example donation
Again, using sections from Metbank npc (credit to them obviously
bottom of chat.cs
Code:
public static void Donation(int value, ClientSocket CSocket)
{
CSocket.Client.Donation += value;
CSocket.Send(ConquerPacket.Status(CSocket, 2, CSocket.Client.Donation, Struct.StatusTypes.Donation));
}
database.cs (where the other ones like it are, search for the wh money one just like in metbank
Code:
Client.Donation = Convert.ToInt32(DR["Donation"]);
database.cs
Code:
public static void SaveDonation(ClientSocket CSocket)
{
MySqlCommand Cmd = new MySqlCommand("UPDATE `characters` SET `Donation` = " + CSocket.Client.Donation + " WHERE `CharID` = " + CSocket.Client.ID + "", DatabaseConnection.NewConnection());
Cmd.ExecuteNonQuery();
Cmd.Connection.Close();
Cmd.Connection.Dispose();
Cmd.Dispose();
}
statustype.cs
character.cs
Code:
public int Donation = 0;
Then for the npctalk part just do something like
Code:
if (CSocket.Client.Donation = value wanted)
{ Text("You can claim your donation reward" , CSocket);
other options here (such as what is rewarded)
Donation(NumberRemoved, CSocket);
Database.Database.SaveDonation(CSocket);
}
else
Text("You do not have a donation to claim" , CSocket);
Obviously not a working npctalk but that's how you would do it, the php side just needs to add a value to the character table to set it to whatever it needs to be