[release]
[b]Screw an intro, you should know what this is, if you don't know what MyBB is, then click [url=http://www.mybb.com]here[/url][/b].
[/release]
[release]
[b]Screen shots[/b]
In-Game
[media]http://img543.imageshack.us/img543/6932/gamevk.jpg[/media]
phpMyAdmin
[media]http://img26.imageshack.us/img26/9210/sqlp.png[/media]
Forums
[media]http://img715.imageshack.us/img715/3491/forumsw.png [/media]
[/release]
[release]
[b]Release[/b]
[url=http://pastebin.com/download.php?i=jk8Mn6xE]Download[/url]
[/release]
[release]
:siren::siren:[b]Requirements.[/b]:siren::siren:
[url=http://gmodmodules.googlecode.com/svn/trunk/gm_tmysql2/Release/gm_tmysql.dll]tmysql[/url]
[url=http://gmodmodules.googlecode.com/svn/trunk/gm_tmysql2/libmysql.dll]libmysql[/url]
[url=http://gmodmodules.googlecode.com/svn/trunk/gm_cryptopp/Release/gm_cryptopp.dll]cryptopp[/url]
You have to alter your `mybb_users` table or this will not work.
[i]Here is code you can paste right in your query box to do it for you[/i].
[code]
ALTER TABLE `mybb_users` ADD `steamid` TEXT NOT NULL AFTER `usernotes`
[/code]
[/release]
[release]
[b]MISC[/b]
Request a feature by posting or personal messaging me.
Like to thank [url=http://community.mybb.com/user-17022.html]frostschutz[/url], on mybb forums for his/her help.
Oh also post bugs or problems you run into.
[/release]
Nice! Might test this soon.
Convert to mysqloo please!
[QUOTE=GuyRun01;28649467]Convert to mysqloo please![/QUOTE]
Fuck that, mysqloo is a piece of shit, keep tmysql.
Also why not make an extra field in users and call it SteamID? and just insert the players steamid in there so you can track em :)
[QUOTE=Buggzie;28649632]Fuck that, mysqloo is a piece of shit, keep tmysql.
Also why not make an extra field in users and call it SteamID? and just insert the players steamid in there so you can track em :)[/QUOTE]
Whats wrong with mysqloo compared to tmysql then? :s
It's because it crashes a little more than tmysql, but tmysql can't handle more than 1 database connection at time.
[editline]17th March 2011[/editline]
Also, I wold suggest you to do checks if the email adress is actually an email adress and so on.
[QUOTE=Loures;28650480]It's because it crashes a little more than tmysql, but tmysql can't handle more than 1 database connection at time.
[editline]17th March 2011[/editline]
Also, I wold suggest you to do checks if the email adress is actually an email adress and so on.[/QUOTE]
Right, now i see....
And yeah, i used to use mybb all the time, opens a LOT of pathways towards proper server/webserver integration. Thanks!
Woot, yay :D! Epic Aide!
[QUOTE=Buggzie;28649632]Fuck that, mysqloo is a piece of shit, keep tmysql.
Also why not make an extra field in users and call it SteamID? and just insert the players steamid in there so you can track em :)[/QUOTE]
Read the OP. I've stated you have to alter your mybb_users table. You need to have a field called `steamid` or this won't work off the bat.
[code]
ALTER TABLE `mybb_users` ADD `steamid` TEXT NOT NULL AFTER `usernotes`
[/code]
Hmm, any possibility to convert this to SMF2? As this is really a great feature! :)
Edit:
As I see, the SMF2 members table is very similar to MyBB... If I'm correct, its just to change these lines:
[lua]DB = "mybb"
tmysql.query("INSERT INTO `mybb_users` (`username`, `password`, `email`, `usergroup`, `allownotices`, `hideemail`, `invisible`, `receivepms`, `showsigs`, `showavatars`, `showquickreply`, `regdate`, `regip`, `lastip`, `steamid`) VALUES ('" .. tmysql.escape(user) .. "', '" .. tmysql.escape(string.lower(crypto.md5(pass))) .. "','" .. tmysql.escape(email) .. "', '".. group .. "', '" .. 1 .. "', '" .. 0 .. "', '" .. 0 .. "', '" .. 1 .. "', '" .. 1 .. "', '" .. 1 .. "', '" .. 1 .. "', '" .. regdate .. "', '" .. self:IPAddress() .. "', '" .. self:IPAddress() .. "', '" .. tmysql.escape(self:SteamID()) .. "' )" , SQLHandle )
tmysql.query( "SELECT `usergroup` FROM `mybb_users` WHERE `steamid`= '" .. id .. "'", function ( Args )
tmysql.query( "SELECT `steamid` FROM `mybb_users` WHERE `steamid`= '" .. id .. "'", function ( Args )
[/lua]
to match the SMF2 members layout? Right? I got some lua knowlegde, but absolutly no MySQL xD.
Edit2:
Just a question, I don't have to fill out all the fields? They can be empty if they are no important? Or do I got to set each value in the right order? Thanks :)
I can create one for smf2 if that's what you'd like. The field you have to fill out are defined by the function only three arguments can be left empty.
( uid, user, pass, email, group, regdate )
Only ones that need to be set are,
( user, pass, email )
As the function will automatically pick them up.
Ok, this is all the fields I can fill out:
[code]
id_member, member_name, date_registered, posts, id_group, lngfile, last_login, real_name, instant_messages,
unread_messages, new_pm, buddy_list, pm_ignore_list, pm_prefs, mod_prefs, message_labels, passwd,
openid_uri, email_address, personal_text, gender, birthdate, website_title, website_url, location, icq, aim, yim,
msn, hide_email, show_online, time_format, signature, time_offset, avatar, pm_email_notify, karma_bad,
karma_good, usertitle, notify_announcements, notify_regularity, notify_send_body, notify_types, member_ip,
member_ip2, secret_question, secret_answer, id_theme, is_activated, validation_code, id_msg_last_visit,
additional_groups, smiley_set, id_post_group, total_time_logged_in, password_salt, ignore_boards, warning,
passwd_flood, pm_receive_from [/code]
What you are saying is that I don't need to define values in all them? I can just define the ones which are important right (member_name, date_reg, id_group, last_login, email, passwd, is_activated) ?
And I don't want to "steal" your time, but if you just want to give me a pointer or bit of help that would be great :) All credits to you ofcourse :)
Thanks :)
Edit:
Okay, this is odd, but I cannot run the tmysql module for some reason...
This happens when I got the module, in the right folder, and with the right filename (as seen in the error):
[code] lua_openscript_cl SMFv1.lua
Running script SMFv1.lua...
error loading module 'tmysql' from file 's:\steam\steamapps\anderen2\garrysmod\garrysmod\lua\includes\modules\gm_tmysql.dll':
The specified module could not be found.
[/code]
This happens if I remove/change name on it:
[code]
lua_openscript_cl SMFv1.lua
Running script SMFv1.lua...
ERROR! Module 'tmysql' not found!
[lua\smfv1.lua:12] attempt to index global 'tmysql' (a nil value)
[/code]
To obtain the password salt you should look inside the registration/login code of SMF.
[QUOTE=Anderen2;28667091]Ok, this is all the fields I can fill out:
[code]
id_member, member_name, date_registered, posts, id_group, lngfile, last_login, real_name, instant_messages,
unread_messages, new_pm, buddy_list, pm_ignore_list, pm_prefs, mod_prefs, message_labels, passwd,
openid_uri, email_address, personal_text, gender, birthdate, website_title, website_url, location, icq, aim, yim,
msn, hide_email, show_online, time_format, signature, time_offset, avatar, pm_email_notify, karma_bad,
karma_good, usertitle, notify_announcements, notify_regularity, notify_send_body, notify_types, member_ip,
member_ip2, secret_question, secret_answer, id_theme, is_activated, validation_code, id_msg_last_visit,
additional_groups, smiley_set, id_post_group, total_time_logged_in, password_salt, ignore_boards, warning,
passwd_flood, pm_receive_from [/code]
What you are saying is that I don't need to define values in all them? I can just define the ones which are important right (member_name, date_reg, id_group, last_login, email, passwd, is_activated) ?
And I don't want to "steal" your time, but if you just want to give me a pointer or bit of help that would be great :) All credits to you ofcourse :)
Thanks :)
Edit:
Okay, this is odd, but I cannot run the tmysql module for some reason...
This happens when I got the module, in the right folder, and with the right filename (as seen in the error):
[code] lua_openscript_cl SMFv1.lua
Running script SMFv1.lua...
error loading module 'tmysql' from file 's:\steam\steamapps\anderen2\garrysmod\garrysmod\lua\includes\modules\gm_tmysql.dll':
The specified module could not be found.
[/code]
This happens if I remove/change name on it:
[code]
lua_openscript_cl SMFv1.lua
Running script SMFv1.lua...
ERROR! Module 'tmysql' not found!
[lua\smfv1.lua:12] attempt to index global 'tmysql' (a nil value)
[/code][/QUOTE]
It means you're missing libmysql.dll.
Downloaded it via: [url]http://gmodmodules.googlecode.com/svn/trunk/gm_tmysql2/libmysql.dll[/url] and put it next to your srcds.exe and if it still doesnt work also copy it to your garrysmod/garrysmod/ directory.
[editline]19th March 2011[/editline]
[QUOTE=Aide;28656619]Read the OP. I've stated you have to alter your mybb_users table. You need to have a field called `steamid` or this won't work off the bat.
[code]
ALTER TABLE `mybb_users` ADD `steamid` TEXT NOT NULL AFTER `usernotes`
[/code][/QUOTE]
Also I didn't notice that bit, my apology.
[QUOTE=Aide;28659908]I can create one for smf2 if that's what you'd like. The field you have to fill out are defined by the function only three arguments can be left empty.
( uid, user, pass, email, group, regdate )
Only ones that need to be set are,
( user, pass, email )
As the function will automatically pick them up.[/QUOTE]
I would love a SMF2 version since most of the time I use SMF anyways
[QUOTE=Buggzie;28671903]
Also I didn't notice that bit, my apology.[/QUOTE]
We all make mistakes.
Working on expanding this a bit more to allow more interaction between garry's mod and website.
[lua]
// Creates a thread as if he/she was on the forums.
function Player:CreateThread( fid, sub, mes ) end
// Creates a private message as if he/she was on the forums.
function Player:PrivateMessage( pmid, sub, mes ) end
[/lua]
Also will be working on SMF2 and SMF1. I already got started on SMF2 but got stuck when I looked at there salt forumla.
If you want a sneak peak at SMF2 look below it's almost a solid copy of this.
sv_smf2.lua
[lua]
require("tmysql")
require("cryptopp")
Host = "localhost" // Host(IP/Hostname)
User = "root" // Username
Pass = "" // Password
DB = "smf" // Databse to select
Port = 3306 // Port, By default it's 3306.
Group = 0 // This is the default group they will be placed into. By default 0 is registered. Must be a number!
WEBURL = "http://www.Changeme.com" // This is your website url.
tmysql.initialize( Host, User, Pass, DB, Port, 2, 2 )
local Player = _R.Player
function SQLHandle( result, _, error )
if error and error != 0 then
print( "SQL ERROR: " .. error )
end
end
// This creates a user as if he/she was registering on the forums.
function Player:RegisterUser( uid, user, pass, email, group, regdate )
if !user or !pass or !email then self:ChatPrint( "[SMF2] Failed to create new user, one of the fields were nil." ) return end
if !group then group = Group or 0 end
if !uid then uid = self:SteamID() end
if !regdate then regdate = os.time() end
tmysql.query("INSERT INTO `smf_members` (`member_name`, `passwd`, `date_registered`, `id_group`, `real_name`, `email_address`, `member_ip`, `member_ip2`, `steamid`) VALUES ('" .. tmysql.escape(user) .. "', '" .. tmysql.escape(string.lower(crypto.sha1(user .. pass))) .. "', '" .. regdate .. "', '" .. group .. "', '" .. tmysql.escape(user) .. "', '" .. email .. "', '" .. self:IPAddress() .. "', '" .. self:IPAddress() .. "', '" .. tmysql.escape(uid) .. "' )" , SQLHandle )
self:ChatPrint( "[SMF2] Successfully registered user, " .. user )
self.Register = true
end
// We can use this for a custom admin mod. Or use this to set admins. You could have your admins be controled via the forums.
function Player:GetUsersGroup( id )
if !id then self:ChatPrint( "[SMF2] Failed to get user, got a nil value in argument." ) return end
tmysql.query( "SELECT `id_group` FROM `smf_members` WHERE `steamid`= '" .. id .. "'", function ( Args )
if (Args && Args[1]) then
self:ChatPrint( "[SMF2] User is a part of group number " .. Args[1] )
// Place some code here to make them an admin. This is of course if you want your admins to be controled by there forum user group.
else
self:ChatPrint( "[SMF2] Failed to get user's group." )
end
end)
end
// We use this to see if he/she is registered.
function Player:GetUsersID( id )
if !id then self:ChatPrint( "[SMF2] Failed to get user, got a nil value in argument." ) return end
tmysql.query( "SELECT `steamid` FROM `smf_members` WHERE `steamid`= '" .. id .. "'", function ( Args )
if (Args && Args[1]) then
self.Register = true
self:ChatPrint( "[SMF2] Welcome back " .. self:Nick() .. ", Remember to visit our forums @ " .. WEBURL )
else
self.Register = false
self:ChatPrint( "[SMF2] Hello " .. self:Nick() .. ", starting registration process." )
// Place some code here to make them register. (Console Command, Datastream, or User Message)
end
end)
end
hook.Add("PlayerInitialSpawn", "FirstSpawn", function( pl )
pl.Register = false
pl:GetUsersID( pl:SteamID() )
end)
concommand.Add("smf2_register", function( pl, cmd, args )
pl.Register = false
if !args[1] or !args[2] then pl:ChatPrint( "[SMF2] Failed to create new user, one of the fields were nil." ) return end
if pl.Register then pl:ChatPrint( "[SMF2] Your already registered." ) return end
pl:RegisterUser(pl:SteamID(), pl:Nick(), args[1], args[2])
end)
[/lua]
This is not full working because of SMF2's salt forumla.
[QUOTE=Aide;28676664]
This is not full working because of SMF2's salt forumla.[/QUOTE]
As I've read you can leave the salt field empty, SMF2 will fill it out automaticly at first login if its missing ;)
Edit: Yeah, just tried myself, added a new user in phpmyadmin, with only data in username, realname and password. The rest filled itself out, and I could login sucessfuly :)
I tried it yesterday when I slightly modded it and was unable to login so thought that `password_salt` had to be generated.
[QUOTE=GuyRun01;28649467]Convert to mysqloo please![/QUOTE]
[url=http://www.garrysmod.org/downloads/?a=view&id=119302][img]http://www.garrysmod.org/img/?t=dll&id=119302[/img][/url]
Good enough?
[QUOTE=Aide;28676664]
[lua]tmysql.query("INSERT INTO `smf_members` (`member_name`, `passwd`, `date_registered`, `id_group`, `real_name`, `email_address`, `member_ip`, `member_ip2`, `steamid`) VALUES ('" .. tmysql.escape(user) .. "', '" .. tmysql.escape(string.lower(crypto.sha1(user .. pass))) .. "', '" .. regdate .. "', '" .. group .. "', '" .. tmysql.escape(user) .. "', '" .. email .. "', '" .. self:IPAddress() .. "', '" .. self:IPAddress() .. "', '" .. tmysql.escape(uid) .. "' )" , SQLHandle )
self:ChatPrint( "[SMF2] Successfully registered user, " .. user )
self.Register = true
end[/lua][/quote]
At this:
[lua]tmysql.escape(string.lower(crypto.sha1(user .. pass))[/lua]
Why are you encrypting username+password with sha1? Removed user and it worked fine ;)
And also, making it all lowcase(string.lower) may not be a good idea as the SMF2 forums are case sensitive ;)
Well, I haven't used SMF 2.0 much. Originally I had it will out "user". I was going off register.php in the source folder. Which isn't always the best way to learn something. Also If I remember correctly either SMF 1 or SMF 2 uses a php equivalent to string.lower.
[QUOTE=Anderen2;28708233]At this:
tmysql.escape(string.lower(crypto.sha1(user .. pass))Why are you encrypting username+password with sha1? Removed user and it worked fine ;)
And also, making it all lowcase(string.lower) may not be a good idea as the SMF2 forums are case sensitive ;)[/QUOTE]
He's probably doing that because cryptopp (mistakenly) makes everything caps. When I was doing vBulletin intergration, I had to use string.lower() because otherwise it generated a completely different hash.
[QUOTE=Teddi Orange;28708317]He's probably doing that because cryptopp (mistakenly) makes everything caps. When I was doing vBulletin intergration, I had to use string.lower() because otherwise it generated a completely different hash.[/QUOTE]
This is true. Any time you generate a string and "encrypt" it with crytopp it is in caps.
[QUOTE=Aide;28708383]This is true. Any time you generate a string and "encrypt" it with crytopp it is in caps.[/QUOTE]
Ahh, I see. I missread, seemed to me that you lowered the password before encrypting it, but understood it now ;)
Okay, I have executed the SQL Query, Edited the file which was included in this archive to suit my databases configuration... Now where do I put this sv_mybb.lua file on the server in order to get it to work???
Thanks,
Jake
Yes on the server
But where on the server? What directory???
lua/autorun/server
Ahhhh, Thanking you sir!
[editline]3rd April 2011[/editline]
lol I put it in my evolve admin plugins directory...
[editline]3rd April 2011[/editline]
The lua is still not executing when I go on my server???
Thanks,
Jake
[QUOTE=King Flawless;28968260]lua/autorun/server[/QUOTE]
While this statement is true. You could include the code into a gamemode lua file or have it loaded by the gamemode as long as it's server side.
[QUOTE=jakeives;28969518]Ahhhh, Thanking you sir!
[editline]3rd April 2011[/editline]
lol I put it in my evolve admin plugins directory...
[editline]3rd April 2011[/editline]
The lua is still not executing when I go on my server???
Thanks,
Jake[/QUOTE]
Explain a bit more.
Sorry, you need to Log In to post a reply to this thread.