One account and one character account?
#1

Hey.

I'm currently making a gamemode just for fun and try to learn pawn. I'm thinking about making a so-called master account system. I have an user control panel where you can register a master account, and you will also register your character through it. In other words; you just login once you connect to the server (with the character account of course).

The thing is that I want so if the master account is admin, all the characters assosciated with that master account will be admin as well. Is that a bad idea? Like, if you have one master account I trust that person - which means all his characters should be admin as well. I know that can be a security risk, however what's the best way of doing that? Do I have to make an inner join or something in MySQL and retrieve info whether the character account is associated with an admin master account?

I need help with finding the best way to deal with it. Like do I have to make a MySQL query every time I want to check if the person is admin or not? Or can I make a variable for that? Anything vulnerable if I do so?

Have a last question too. When a player disconnects people usually store all the player info of the person leaving. If I make everything update once changes are made, I don't have to do that I assume. But will this affect the server in a bad way? Imagine having like 200 players, and every changes are being updated to MySQL. E.g if 50 players change their skin at the same time - there will be 50 queries to the database at the same time, won't that make it load slow or? I have no clue, just thinking about things that could happen and whether it's a good idea or not. Because then there isn't any chance of rollbacks?

Thanks in advance!
Reply
#2

Anyone?
Reply
#3

No no don't matter thinking on saving stats OnPlayerUpdate, its a bad idea.
And about your idea, you mean if Player1 admin, Play will be admin, yer1 ill be admin...ect?
Reply
#4

So it is a bad idea to update once changes are made? Hm that is very unfortunate. I wasn't thinking directly about OnPlayerUpdate. Was thinking e.g a person uses /buy and buys a cigarette. When he does that there'll be ran a query updating the database, telling him that he has a cigarette (bad example as I wouldn't save that, but you get it). Or a skin for example. You go to a clothing store and buy a new skin, it gets updated in the database immediately. Or if admin uses /setskin, a query will be ran. If everything that will be stored in the database is being ran immediately once a change like that has been done, then there will never be any rollbacks?


I have a master account system and a character system right now. Two different accounts.
If you have a master account, you can create a character. That character will have a "owner" field in the database including the master accounts unique ID. In other words they are connected in one way. You can only log onto the server using your character account.

However the master account has an admin field in the database, an integer. That shows what admin level you have, but I want the character to be admin ingame as well - if the master account has an admin rank. How should I do that in a best way possible? To retrieve that data, and make the character admin in-game.

if character is owned by a master account with an admin rank = character is admin
Reply
#5

No it is not a bad idea to update when changes are made,in fact proper way to do this is update data which are important whenever they are made, I.E money change, adminlvl change and etc.
but save other less important stuff on a timer or on OPDC, like position, skin.
Having admins on database is easy, since you can always keep track of which accounts are admin with a single yet a bit advanced query (using JOIN to combine both tables), but it is also recommended to immediately strip the admin level if you suspect account sharing (different IP/gpci) so your admins wouldn't share their accounts with friends to have admin powers.

Again, for loading you need to learn how to use JOIN, you can simply join the master account, directly retrieving adminlvl when someone logs in, in the same query you use for loading player's stats.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)