Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MySQL Errors with latest version #40

Closed
FreakySt0rm opened this issue Apr 4, 2014 · 7 comments
Closed

MySQL Errors with latest version #40

FreakySt0rm opened this issue Apr 4, 2014 · 7 comments

Comments

@FreakySt0rm
Copy link

Hi, I've downloaded and installed the latest version from GitHub, installation went perfectly, but now I can't access sm_admin even though I've set up myself as a server admin, and I'm getting these lines in the SourceMod logs:
L 04/04/2014 - 10:58:24: [sourcebans.smx] Failed to query database. (Unknown column 'ip' in 'where clause')

L 04/04/2014 - 10:58:29: [sourcebans.smx] Failed to query database. (Cannot add or update a child row: a foreign key constraint fails (sourcemod.sb_actions, CONSTRAINT action_server FOREIGN KEY (server_id) REFERENCES sb_servers (id) ON DELETE CASCADE))

Am I doing anything wrong, or is this a known issue?

Many thanks!

FreakySt0rm - St0rm.net Gaming

@ErikMinekus
Copy link
Member

Yes, I broke the game plugin with the latest commits. I'll see if I can fix it this weekend.

@FreakySt0rm
Copy link
Author

lol - Ok, no problem - Just checking it wasn't me being a n00b ;) lol Love the new WebPanel btw :) Would that explain why no admins have powers in the servers?

@Drixevel-Archive
Copy link

Any fixes for this yet my good man? Can't seem to find any updates that fix it.

@WildCard65
Copy link

go into sourcebans.sp and find:

Format(sQuery, sizeof(sQuery), "SELECT id \
                                    FROM   {{servers}} \
                                    WHERE  ip   = '%s' \
                                      AND  port = %i",
                                    g_sServerIp, g_iServerPort);
    SB_Query(Query_ServerSelect, sQuery);

and change ip to host so it looks like this:

Format(sQuery, sizeof(sQuery), "SELECT id \
                                    FROM   {{servers}} \
                                    WHERE  host   = '%s' \
                                      AND  port = %i",
                                    g_sServerIp, g_iServerPort);
    SB_Query(Query_ServerSelect, sQuery);

save and recompile sourcebans.smx, move it from compiled folder into plugins folder and voila.

@FreakySt0rm
Copy link
Author

After using Wildcard65's fix, I was still getting an error of (Unknown column "ip" in "field list") and needless to say, the plugin was still not working (didn't allow admins access to the sm_admin menu). To fix this, you need to edit line 246 of sourcebans.sp from:

Format(sQuery, sizeof(sQuery), "INSERT INTO {{servers}} (ip, port, game_id) \

to:

Format(sQuery, sizeof(sQuery), "INSERT INTO {{servers}} (host, port, game_id) \

After this fix, the plugin works 😄 👯

If anyone wants the source/complied plugin you can go to: http://freaky.st0rm.net/sourcebans-fixed and download them 😉

@WildCard65
Copy link

My fix only works if you already have the server added to the database.

@WildCard65
Copy link

@peace-maker can you close this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants