Hello,
I've been trying to create a Kill streak announcer.
This is how it should work:
Attacker kills victim -> DB streak updated, Attack +1, victim reset to 0 -> If attacker has got 10 -> Announce.
This is my code so far, I know, it's nothing... I am still learning so.
Code:
QueryResult * sStreak = CharacterDatabase.Query("SELECT streak FROM characters WHERE name = %s", attacker->GetName());
if(sStreak)
{
Field *Fields = sStreak->Fetch();
uint32 streakcount = Fields[0].GetUInt32() + 1;
CharacterDatabase.Query("UPDATE characters SET streak = %u WHERE name = %s", streakcount, attacker->GetName());
}
Ofcourse there's more, but this is just the part where the Kill streak gets to work.
I've actually got no idea how to work with Query's, I do know how to write SQL query's, but not sure how to get the results in C++.
Compile works fine without errors, but when I kill, the DB doesn't get updated.
I would appreciate some help, thanks.
EDIT:
Nevermind! I did my SQL Query wrong!