General > Developers Corner

Working MySQL User Authentication with Global Ban support

<< < (3/5) > >>

gameguysz:

--- Quote from: MrPresident on February 24, 2011, 11:56:35 PM ---did you add yourself to superadmin using this mod? It doesn't pull in anything from the users.txt or from your existing ULX users file.


with or without yourself in game... type the following..


--- Code: ---g4p_setgroup "STEAMID" superadmin
--- End code ---
note that the steamid is in quotes.

This is, also, unless you changed the concommands.

Also.. if you have access to the SQL database you can manually change your group there. You'd need to reconnect to the server if you do it this way though. (assuming you were connected when you made the change)

--- End quote ---

And now that user will be a superadmin via ULX mod right? Like he will be able to use the ULX commands?

MrPresident:
Yep. This sql module effectively replaces the built in ULib user authentication. Instead of reading from the text file it reads from the database. If the user doesnt exist on the database but exists on the text file it will create a new entry in the database and default to user and then overwrite the text file.

The text file will still exist and will still be updated.. this is just as a backup. In case something happens to your database you'll still be able to uninstall the sql module and all of your users will still work.

gameguysz:
Oh COOL!!!!!! :D Okay last question!!
 :]


I want to be able to refer the steam id and username and so forth from the data base in other files.

I actually made a npc shop and in the database i made another table to money. I want to be able to access that. will i need to refer this file?

(Im still kinda new to mysql and lua i normally program in html and php but even then im not pro)

MrPresident:
it's actually really easy.


What I do is I have the database create entity variables when the player joins..

so the information saved in the database is stored as such..

Name: ply.name
SteamID: ply.steamid
Group: ply.group
Banned: ply.banned


So you can easily reference this information with any other serverside lua script by simply reading that variable off of the player entity.

Hopefully that is straight forward enough for you to understand?



EDIT: I just re-read your post.. what did you call the money table.. you'll need to modify my file a little bit. I'll help you out just tell me what you called the money table. Also.. did you make a new table or a new column in the current table? It would be much easier if you just make a new column.

gameguysz:

--- Quote from: MrPresident on February 25, 2011, 12:25:09 AM ---it's actually really easy.


What I do is I have the database create entity variables when the player joins..

so the information saved in the database is stored as such..

Name: ply.name
SteamID: ply.steamid
Group: ply.group
Banned: ply.banned


So you can easily reference this information with any other serverside lua script by simply reading that variable off of the player entity.

Hopefully that is straight forward enough for you to understand?



EDIT: I just re-read your post.. what did you call the money table.. you'll need to modify my file a little bit. I'll help you out just tell me what you called the money table.

--- End quote ---


Kinda, btw thanks for helping me i know it can get annoying


So what your saying is, ill have those same variables but at the bottom ill add something like this

GCcash: ply.gccash


and lets say in a completely different folder like im making a derma menu what would that command be to take out a certain amount? And would i also need to connect to the database again? Its stuff like this that confuses me XD

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version