Saving team - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Saving team (
/showthread.php?tid=382330)
Saving team -
Face9000 - 02.10.2012
Ok so,i started scripting the team saving for my gamemode and i have a problem.
I use the pTeam variable to save it,like:
pawn Код:
INI_WriteInt(File,"Team",PlayerInfo[playerid][pTeam]);
The question now is:
How i save the team?What i should add to the OnPlayerRequestClass callback?
And after i save it,how i make the player spawn automatically after he login?This is the login part:
pawn Код:
case DIALOG_LOGIN:
{
if (!response) return Kick(playerid);
if( response )
{
if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
SetPlayerScore(playerid, PlayerInfo[playerid][pKills]);
ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,"{008000}Success!","{FFFF00}You have successfully logged in!","Ok","");
Rules(playerid);
}
else
{
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"Login","{FF0000}You have entered an incorrect password.\n""Type your password below to login.","Login","Quit");
}
return 1;
}
}
}
Re: Saving team -
Passout - 03.10.2012
SpawnPlayer(playerid);
Try that
Re: Saving team -
SwisherSweet - 03.10.2012
That might help...
EDIT: The guy ^ got it before me...
Re: Saving team - Glint - 03.10.2012
For saving player's team, you need to get his team when he disconnects and save it to his file.
And for the auto login create an IP saving line that saves player's IP into his file then when he connects use strcmp to check if his IP and the one in his file match or not, if they do then log him in, if they don't then show him the login dialog.
Re: Saving team -
Face9000 - 03.10.2012
Quote:
Originally Posted by [Lexi]
For saving player's team, you need to get his team when he disconnects and save it to his file.
And for the auto login create an IP saving line that saves player's IP into his file then when he connects use strcmp to check if his IP and the one in his file match or not, if they do then log him in, if they don't then show him the login dialog.
|
I don't want use autologin IP,it's not safe for me,i've a login dialog on OnPlayerConnect so after the player logs,he will spawn automatically.