Skin isn't loading
#1

Hey guys, I have a problem. Well first on my script when the player registers it sets their skin id '299' (claude skin)
Then when I log back in it sets it to CJ skin.

Here's my code


For On Dialog Response
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch( dialogid )
    {
        case DIALOG_REGISTER:
        {
            if (!response) return Kick(playerid);
            if(response)
            {
                if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""COL_WHITE"Registering...",""COL_RED"You have entered an invalid password.\n"COL_WHITE"Type your password below to register a new account.","Register","Quit");
                new INI:File = INI_Open(UserPath(playerid));
                INI_SetTag(File,"data");
                INI_WriteInt(File,"Password",udb_hash(inputtext));
                INI_WriteInt(File,"Cash",10000);
                INI_WriteInt(File,"Admin",0);
                INI_WriteInt(File,"Kills",0);
                INI_WriteInt(File,"Deaths",0);
                INI_WriteInt(File,"Level",1);
                INI_WriteInt(File,"Skin",299);
                INI_Close(File);

                SetSpawnInfo(playerid, 0, 299, 1642.3607, -2237.6353, 13.4985, 178.3274, 0, 0, 0, 0, 0, 0);
                SpawnPlayer(playerid);
                ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"Great! Your Y_INI system works perfectly. Relog to save your stats!","Ok","");
            }
        }

        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][pLevel]);
                    SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]);
                    SpawnPlayer(playerid);
                    ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"You have successfully logged in!","Ok","");
                }
                else
                {
                    ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_RED"You have entered an incorrect password.\n"COL_WHITE"Type your password below to login.","Login","Quit");
                }
                return 1;
            }
        }
    }
    return 1;
}
Here's my onplayerdisconnect which saves the skin.
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    new INI:File = INI_Open(UserPath(playerid));
    INI_SetTag(File,"data");
    INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
    INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
    INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
    INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
    INI_WriteInt(File,"Level",GetPlayerScore(playerid));
    INI_WriteInt(File,"Skin",GetPlayerSkin(playerid));
    INI_Close(File);
    return 1;
}
And finally here's my enum.
pawn Код:
enum pInfo
{
    pPass,
    pCash,
    pAdmin,
    pKills,
    pDeaths,
    pLevel,
    pSkin
}
new PlayerInfo[MAX_PLAYERS][pInfo];
Didn't I do this all correctly? When the player disconnects it saves the skin.

And when the player registers, on setspawninfo, it sets the player's skin id '299'(claude skin).

Also I got the enum, for skin.
Reply
#2

Where is the parse function?
Reply
#3

I am not sure, but to have SetSpawnInfo working, you gotta spawn the player after that, so have a variable for being registered on the server, and if the value is true which should be if registering, you spawn the player, making if he /she has that value set to true, it spawns him away from logged in players.
Reply
#4

Quote:
Originally Posted by VincentDunn
Посмотреть сообщение
Where is the parse function?
Do you mean the parse function is this?

pawn Код:
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
Reply
#5

Quote:
Originally Posted by Randy More
Посмотреть сообщение
I am not sure, but to have SetSpawnInfo working, you gotta spawn the player after that, so have a variable for being registered on the server, and if the value is true which should be if registering, you spawn the player, making if he /she has that value set to true, it spawns him away from logged in players.
pawn Код:
SpawnPlayer(playerid);
I have the SpawnPlayer(playerid);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)