PDA

View Full Version : Saving team


KinderClans
30/07/2018, 10:52 AM
Hello, i wanna know if it's possible to save and load on MySQL the team selected by the player.

Example: I choose USA and when i relog i'll auto-spawn as USA Team (matching the correct classid), how i can do it?

Rufio
30/07/2018, 01:14 PM
It's certainly possible. Create a variable that'll hold player's teams and save it in your MySQL database, then load it every time a player logs in and set their team to the variable you've created. As for classid, you could make it so that if a player spawns with a certain classid, it sets their team variable to a certain team.

Exhibit
30/07/2018, 01:15 PM
Save the team id and skin id as an integer in the database on PlayerDisconnect and then load it when the player connects.

Then
use setspawninfo on onplayerrequest class and set the team and skin id then use Spawnplayer(playerid).
Not that SetSpawnInfo doesn't set the team correctly to use SetPlayerTeam on onplayerspawn