View Single Post
DarkDeviL
SourceMod Moderator
Join Date: Apr 2012
Old 08-12-2017 , 14:19   Re: [Store] Daily Credits (v1.4, 2017-08-10)
Reply With Quote #18

Quote:
Originally Posted by Nachtfrische View Post
You also might want to account for the Steam ID being "STEAM_ID_PENDING" sometimes, so make sure you filter it out somehow.
Don't filter such things, just do things properly:

-> https://github.com/yash1441/DailyCre...s_mysql.sp#L56
-> https://github.com/yash1441/DailyCre...s_mysql.sp#L79

Bad code:

Code:
	GetClientAuthId(client, AuthId_Steam2, steamId, sizeof(steamId));
	char buffer[200];
	Format(buffer, sizeof(buffer), "SELECT * FROM players WHERE steam_id = '%s'", steamId);
Good code would be like:

Code:
	if (GetClientAuthId(client, AuthId_Steam2, steamId, sizeof(steamId))) {
		/* Do what you want with the Steam ID here */
	}
GetClientAuthId returns TRUE if a proper Steam ID was received, so therefore, put it in a IF to make sure.

Not checking / validating the data you receive properly ... usually leads to strange results.
__________________
Mostly known as "DarkDeviL".

Dropbox FastDL: Public folder will no longer work after March 15, 2017!
For more info, see the [SRCDS Thread], or the [HLDS Thread].

Last edited by DarkDeviL; 08-12-2017 at 14:19.
DarkDeviL is offline