Raised This Month: $51 Target: $400
 12% 

[Store] Daily Credits (v2.2, 2017-11-10) [MySQL Support]


Post New Thread Reply   
 
Thread Tools Display Modes
yash1441
Senior Member
Join Date: Feb 2015
Location: Illuminati HQ
Old 08-10-2017 , 17:42   Re: [Store] Daily Credits (v1.4, 2017-08-10)
Reply With Quote #11

Quote:
Originally Posted by Kamizun View Post
Created the Database, connected but I can just spam sm_daily and get credits everytime.
The plugin created the tables but its not writting down the connected players or who use the commands.



There are error logs:
Code:
 [SM] Exception reported: Current result set has no fetched rows
 [SM] Blaming: dailycredits_mysql2.smx
 [SM] Call stack trace:
 [SM]   [0] SQL_FetchInt
 [SM]   [1] Line 94, ...\dailycredits_mysql2.sp::GiveCredits
 [SM]   [2] Line 70, ...\dailycredits_mysql2.sp::Cmd_Daily
 [SM] Exception reported: Current result set has no fetched rows
 [SM] Blaming: dailycredits_mysql2.smx
 [SM] Call stack trace:
 [SM]   [0] SQL_FetchInt
 [SM]   [1] Line 95, ...\dailycredits_mysql2.sp::GiveCredits
 [SM]   [2] Line 70, ...\dailycredits_mysql2.sp::Cmd_Daily
Add: I did not forget to remove the old one and I did not change any code from the plugin. I changed the name to dailycredits_mysql2 because I already had one on my desktop
Thank you for your time
Fixed! Forgot to use the query stored in buffer
__________________
yash1441 is offline
Send a message via Skype™ to yash1441
Kamizun
AlliedModders Donor
Join Date: May 2015
Location: Portugal
Old 08-10-2017 , 21:43   Re: [Store] Daily Credits (v1.4, 2017-08-10)
Reply With Quote #12

Still having the same error, tried the one on alliedmods and github. Both are giving me the same error.
Kamizun is offline
yash1441
Senior Member
Join Date: Feb 2015
Location: Illuminati HQ
Old 08-11-2017 , 04:19   Re: [Store] Daily Credits (v1.4, 2017-08-10)
Reply With Quote #13

Quote:
Originally Posted by Kamizun View Post
Still having the same error, tried the one on alliedmods and github. Both are giving me the same error.
Try now, it should work. I hope
If it doesn't, does it create rows with the player info now?
__________________

Last edited by yash1441; 08-11-2017 at 07:07.
yash1441 is offline
Send a message via Skype™ to yash1441
Kamizun
AlliedModders Donor
Join Date: May 2015
Location: Portugal
Old 08-11-2017 , 13:30   Re: [Store] Daily Credits (v1.4, 2017-08-10)
Reply With Quote #14

Quote:
Originally Posted by yash1441 View Post
Try now, it should work. I hope
If it doesn't, does it create rows with the player info now?
Having the exact same problem. Tried both, alliedmodders and github. None of them work and none of them create rows with player info.
Kamizun is offline
yash1441
Senior Member
Join Date: Feb 2015
Location: Illuminati HQ
Old 08-12-2017 , 02:08   Re: [Store] Daily Credits (v1.4, 2017-08-10)
Reply With Quote #15

Quote:
Originally Posted by Kamizun View Post
Having the exact same problem. Tried both, alliedmodders and github. None of them work and none of them create rows with player info.
Ok, I added threaded queries and some more things.
[SM] [0] SQL_FetchInt shouldn't actually give an error because it should only be reached when the player is not in it's first day.
__________________

Last edited by yash1441; 08-12-2017 at 08:56.
yash1441 is offline
Send a message via Skype™ to yash1441
Nachtfrische
Member
Join Date: Aug 2015
Location: Dream Community
Old 08-12-2017 , 12:42   Re: [Store] Daily Credits (v1.4, 2017-08-10)
Reply With Quote #16

Hey, great plugin.

I have one suggestion to make, please add a "UNIQUE" to the steam ID of the CREATE TABLE SQL statement.
Like this:
Code:
CREATE TABLE IF NOT EXISTS players (steam_id VARCHAR(20) UNIQUE, last_connect INT(12), bonus_amount INT(12));
You also might want to account for the Steam ID being "STEAM_ID_PENDING" sometimes, so make sure you filter it out somehow.

Last edited by Nachtfrische; 08-12-2017 at 12:42.
Nachtfrische is offline
yash1441
Senior Member
Join Date: Feb 2015
Location: Illuminati HQ
Old 08-12-2017 , 13:51   Re: [Store] Daily Credits (v1.4, 2017-08-10)
Reply With Quote #17

Quote:
Originally Posted by Nachtfrische View Post
Hey, great plugin.
Thanks man

Quote:
Originally Posted by Nachtfrische View Post
I have one suggestion to make, please add a "UNIQUE" to the steam ID of the CREATE TABLE SQL statement.
Like this:
Code:
CREATE TABLE IF NOT EXISTS players (steam_id VARCHAR(20) UNIQUE, last_connect INT(12), bonus_amount INT(12));
I'll add this to the next update. Also, just for the knowledge, is there any reason for this because I don't think there is any way for duplicate entries anyways?


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.
I think that was fixed with Sourcemod 1.8 although I'll add the check if it is really necessary.
__________________
yash1441 is offline
Send a message via Skype™ to yash1441
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
yash1441
Senior Member
Join Date: Feb 2015
Location: Illuminati HQ
Old 08-12-2017 , 15:38   Re: [Store] Daily Credits (v1.4, 2017-08-10)
Reply With Quote #19

Updated with arne1288's suggestion. Also added UNIQUE to steam_id. Thanks!
__________________

Last edited by yash1441; 08-12-2017 at 15:38.
yash1441 is offline
Send a message via Skype™ to yash1441
Nachtfrische
Member
Join Date: Aug 2015
Location: Dream Community
Old 08-12-2017 , 16:16   Re: [Store] Daily Credits (v1.4, 2017-08-10)
Reply With Quote #20

Good job!
I've had another idea, could you perhaps add a cvar, which limits the max amount of credits you can recieve?
To elaborate: let's say I start with 10 Credits and I get 5 more credits each day, so 10, 15, 20...
At some point, I will be getting 100, 105, 110 credits each day and that can quickly add up and then be too much to give out.

So if you can make a cvar which you can set to, let's say 50, as soon as you reach 50 credits, the amount you recieve won't increase and you'll be getting 50 credits everyday as long as you keep up your daily streak.

Thanks.

Last edited by Nachtfrische; 08-12-2017 at 16:16.
Nachtfrische is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 11:18.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode