Saving team
#1

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;
            }
        }
    }
Reply
#2

SpawnPlayer(playerid);
Try that
Reply
#3

pawn Код:
SpawnPlayer(playerid);
That might help...

EDIT: The guy ^ got it before me...
Reply
#4

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.
Reply
#5

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.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)