Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Renegade Discussions » Mod Forum » SSGM Chat Hook
Re: SSGM Chat Hook [message #274637 is a reply to message #274298] Fri, 20 July 2007 23:28 Go to previous messageGo to previous message
Whitedragon is currently offline  Whitedragon
Messages: 832
Registered: February 2003
Location: California
Karma:
Colonel
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.


Black-Cell.net
Network Administrator (2003 - )

DragonServ, Renegade's first IRC interface bot
Creator and lead coder (2002 - )

Dragonade, Renegade's first server side modification
Lead coder (2005 - )
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: 3ds max 9 problem
Next Topic: Anti Alias without 3.4.1
Goto Forum:
  


Current Time: Fri Feb 14 13:15:14 MST 2025

Total time taken to generate the page: 0.00969 seconds