Amount/Game objects
int Amount = (int)atoi(Text[2].c_str()); //Turn the amount into an int.
GameObject *Donater = Get_GameObj(ID); //Get the gameobj of the player who's donating.
GameObject *Receiver = Get_GameObj_By_Player_Name(Text[1].c_str()); //Get the gameobj of the player being being donated to.
You also need to check if the amount is a valid number.
bool IsNum(const char *sPtr) {
while (*sPtr != '\0') {
if (*sPtr < 48 || *sPtr > 57) return false;
++sPtr;
}
return true;
}
if (!IsNum(Text[2].c_str()) || Text[2].size() > 6) { //If it contains letters or is too big.
return;
}
And of course you need to check if the players are on the same team and if the donater has enough credits.