Posts: 31
Threads: 7
Joined: Apr 2013
Reputation:
0
So when making the table, I want each player to store values for score, money, robskill, coprank, bankcash, and store up to 9 vehicles. Is there a better way to do the 9 vehicles instead of having a column for vehicle1x, vehicle1y, vehicle 1z, angle1, 1color1, 1color2, all the way to 9color1, 9color2, ect?
Posts: 1,765
Threads: 1
Joined: Aug 2011
Reputation:
0
If your using an old file system write and load from strings, so...
Format(Car1string, sizeof(...), "%i|%i"' PScore, Pmoney); then save that as one line...
Posts: 186
Threads: 15
Joined: Apr 2012
Reputation:
0
I'd say the best way is to have another Mysql database for vehicles and link the vehicle to the player somehow. I'd suggest having a vehicle variable like playerSQLID where you store the SQLID of the player who owns the vehicle.
Posts: 1,564
Threads: 98
Joined: Apr 2011
Reputation:
0
Create a new table for just the vehicles. Only thing you have to add extra, is the username.
So it will be like vehicleid, owner, vehiclemodel, x, y, z, a, color, color, respawn
Posts: 31
Threads: 7
Joined: Apr 2013
Reputation:
0
And bam I'm confused. Why would Pscore and Pmoney be in the carstring?
Posts: 1,765
Threads: 1
Joined: Aug 2011
Reputation:
0
It was an example, I don't read you were using MySQL, I suggest numbering your vehicles in the MySQL table.. Then in the player table say Vehicle1 - 23
The. Search for vehicle 23 in the car table... As it quicker than comparing strings in MySQL or so I've been told.
Posts: 186
Threads: 15
Joined: Apr 2012
Reputation:
0
You can store the player SQLID or name on the vehicle or you can store the vehicle SQLID on the player and spawn the car when the player logs in. Your best bet would be to store an SQLID somewhere as that would be much more reliable than just the players name.
Posts: 31
Threads: 7
Joined: Apr 2013
Reputation:
0
Okay going to try these now. Thanks very much guys, hopefully this will fix that other bug I was having in my other post.
Posts: 1,564
Threads: 98
Joined: Apr 2011
Reputation:
0
You can either do what they say above here, or just save it through the players name. Not by playerid, since your playerid will always be different.
Posts: 1,765
Threads: 1
Joined: Aug 2011
Reputation:
0
Playerid would be stupid they were going by the Belief he had numbered each players account so if 100 would registered the next account. Would be 101. Which is what big corporations do, he never said this which is why I never suggested that way. By numbering the vehicles and placing the I'd of the vehicle in the players account, he can choose weather to spawn that vehicle or not as we don't know what he plans to do...