PDA

View Full Version : Saving team


Face9000
02/10/2012, 10:51 PM
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:

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:

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;
}
}
}

Passout
03/10/2012, 02:57 AM
SpawnPlayer(playerid);
Try that

SwisherSweet
03/10/2012, 03:00 AM
SpawnPlayer(playerid);

That might help...

EDIT: The guy ^ got it before me...

Glint
03/10/2012, 03:53 AM
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.

Face9000
03/10/2012, 07:10 AM
;2150756']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.