Player Account Issue
#1

So I have a log in system with my role-play server and today I found quite an interesting bug. Now I'm not sure exactly what is causing this bug, and that's why I'm posting this.

So basically it works like this, if I log out of my account named: Test_Test and that accounts skin is set to like 190 and say I have like 2 vehicles or something owned on that account, if I then log out and log into a completely new account and register it with a password, for some reason my skin is set to that of Test_Test's account and I am able to access Test_Test's accounts vehicles.

So basically I maintain the data from Test_Test's account when I register the new account for some reason.

I'm not quite sure what part of the code to post as it is quite a big login system, but just reply if some code is needed.

But I feel as if it's something to do with the fact that when I log out of Test_Test's account his playerid is 0 and when I log into the new registered account the playerid is also 0.

However I'm not exactly sure how to fix this, thanks for reading.
Reply
#2

Maybe try resetting the account variables when a player connects/disconnects?
Reply
#3

Quote:
Originally Posted by Abagail
Посмотреть сообщение
Maybe try resetting the account variables when a player connects/disconnects?
Okay so by resetting the skin variable to 0 upon disconnect it appears to have fixed the skin issue, so I guess I'll just rinse and repeat for all the other variables. If all goes well I'll reply to this post.
Reply
#4

Okay so the majority of that worked. However the only thing that goes over is the Car Key which is basically what I use for the car system.

The way it works is like, the CarKey1 and CarKey2 is equal to the vehicleid of the vehilce when you spawn it so basically, I can't really set it to 0 because then if I reconnect on the account that owns the car I won't be able to unlock it or lock it. And I don't really want to have to despawn player vehicles upon them disconnecting.

So basically is there a better way to make the CarKey system better?
Reply
#5

Well, - maybe just store the key variables into a file or database if they are not online, - and load that data using the variables once they connect?
Reply
#6

Quote:
Originally Posted by Abagail
Посмотреть сообщение
Well, - maybe just store the key variables into a file or database if they are not online, - and load that data using the variables once they connect?
The only issue with that is if they log on and a different vehicle has the vehicle id stored in their save file. They will get access to it.
Reply
#7

Do you have an account ID system? If you do, you could store it per vehicle, - and store the actual vehicle owner account ID for that vehicle.
Reply
#8

Quote:
Originally Posted by Abagail
Посмотреть сообщение
Do you have an account ID system? If you do, you could store it per vehicle, - and store the actual vehicle owner account ID for that vehicle.
Each account has its own ID in the database, yes. But how would I go about foing that?
Reply
#9

Basically get the account ID upon vehicle spawn, or wherever the variable is activated and then, for example do this using your own variables, etc,

pawn Код:
new accountid;
accountid = GetAccountID(playerid);
CarKeys1[vehicleid] = accountid;
Then to check who owns the vehicle you'd do,
pawn Код:
if(CarKeys1[vehicleid] == GetAccountID(playerid))
or similar. Hope this helps.
Reply
#10

Quote:
Originally Posted by Abagail
Посмотреть сообщение
Basically get the account ID upon vehicle spawn, or wherever the variable is activated and then, for example do this using your own variables, etc,

pawn Код:
new accountid;
accountid = GetAccountID(playerid);
CarKeys1[vehicleid] = accountid;
Then to check who owns the vehicle you'd do,
pawn Код:
if(CarKeys1[vehicleid] == GetAccountID(playerid))
or similar. Hope this helps.
So it seems like I finally got everything working, thanks. I appreciate your help +Rep
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)