SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 30/07/2018, 10:52 AM   #1
KinderClans
Banned
 
Join Date: May 2018
Location: Italy
Posts: 716
Reputation: 43
Default Saving team

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?
KinderClans is offline   Reply With Quote
Old 30/07/2018, 01:14 PM   #2
Rufio
Huge Clucker
 
Join Date: May 2011
Location: Turkey
Posts: 412
Reputation: 40
Default Re: Saving team

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.
Rufio is offline   Reply With Quote
Old 30/07/2018, 01:15 PM   #3
Exhibit
Big Clucker
 
Join Date: Dec 2015
Location: Pakistan
Posts: 180
Reputation: 22
Default Re: Saving team

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
Exhibit is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Team saving cray1100 Scripting Help 3 02/08/2013 07:45 AM
Team ID not saving arjanforgames Scripting Help 1 27/07/2013 07:15 AM
Saving team Face9000 Scripting Help 4 03/10/2012 07:10 AM
Team saving samuel_hamza Help Archive 9 19/06/2010 12:58 AM
Saving team? kmzr Help Archive 3 24/02/2010 02:07 PM


All times are GMT. The time now is 05:03 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.