This isn't doing what i want it to do :P
#1

Good afternoon SAMP users!

Heres is my DIALOG_LOGIN that is located under OnDialogResponse

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]);
                    SetPlayerSkin(playerid,PlayerInfo[playerid][pSkin]);
                    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;
}
Im trying to make it load the string in the script files of Skin.

But, its not loading it!

It saves it correctly, but it just doesn't load the skin once i log in.

Help please?
Reply
#2

How are you saving the skin can we see the saving line?
Or check your player file see if next to the save Skin it has the skinid there
Reply
#3

Read the post again/

Quote:

It saves it correctly, but it just doesn't load the skin once i log in.

Help please?

Heres my log.

PHP код:
Password 229049008
Cash 
0
Admin 
10
Kills 
0
Deaths 
0
VIP 
5
Skin 
117 
Reply
#4

Right this is my last reply as im eating my pizza...

Are you loading the skin like this?


INI_Int("Banned", PlayerInfo[playerid][pBanned]);

before you try to load it when they login plus if you are try setting there skin when they spawn

pawn Код:
public OnPlayerSpawn...
Reply
#5

pawn Код:
SetPlayerSkin(playerid, Skin);
Maybe? Dunno your saving system, in my script i have it enum pInfo so I use:
pawn Код:
SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]);
Reply
#6

Im pretty much doing it like you would with cash, but im not.

Hers all Skin related.


pawn Код:
enum pInfo
{
    pPass,
    pCash,
    pAdmin,
    pKills,
    pDeaths,
    pVIP,
    pSpeed,
    pJump,
    pSkin
}
pawn Код:
public LoadUser_data(playerid,name[],value[])
{
    INI_Int("Password",PlayerInfo[playerid][pPass]);
    INI_Int("Cash",PlayerInfo[playerid][pCash]);
    INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
    INI_Int("Kills",PlayerInfo[playerid][pKills]);
    INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
    INI_Int("VIP",PlayerInfo[playerid][pVIP]);
    INI_Int("Speed",PlayerInfo[playerid][pSpeed]);
    INI_Int("Jump",PlayerInfo[playerid][pJump]);
    INI_Int("Skin",PlayerInfo[playerid][pSkin]);
    return 1;
}
pawn Код:
public OnPlayerConnect(playerid)
{
    new string[64], pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
    format(string,sizeof string,"%s has joined the server!",pName);
    SendClientMessageToAll(0xFFFFFFAA,string);
   
    if(fexist(UserPath(playerid)))
    {
        INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
        ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_WHITE"Type your password below to login.","Login","Quit");
    }
    else
    {
        ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,""COL_WHITE"Registering...",""COL_WHITE"Type your password below to register a new account.","Register","Quit");
    }
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{

    new string[64], name[MAX_PLAYER_NAME];
    GetPlayerName(playerid,name,MAX_PLAYER_NAME);
    switch(reason)
    {
        case 0: format(string,sizeof string,"%s left the server. (Timed out)",name);
        case 1: format(string,sizeof string,"%s left the server. (Leaving)",name);
        case 2: format(string,sizeof string,"%s left the server. (Kicked/Banned)",name);
    }
    SendClientMessageToAll(0xFFFFFFAA,string);
   
    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,"VIP",PlayerInfo[playerid][pVIP]);
    INI_WriteInt(File,"Skin",GetPlayerSkin(playerid));
    INI_Close(File);
    return 1;
}
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",0);
                INI_WriteInt(File,"Admin",0);
                INI_WriteInt(File,"Kills",0);
                INI_WriteInt(File,"Deaths",0);
                INI_WriteInt(File,"VIP",0);
                INI_WriteInt(File,"Skin",0);
                INI_Close(File);

                SetSpawnInfo(playerid, 0, 0, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0);
                SpawnPlayer(playerid);
                ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"Thank you for registering! 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]);
                    SetPlayerSkin(playerid,PlayerInfo[playerid][pSkin]);
                    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;
}
Reply
#7

At
pawn Код:
public OnPlayerSpawn
put:
pawn Код:
SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]);
EDIT: and change
pawn Код:
INI_WriteInt(File,"Skin",GetPlayerSkin(playerid));
to:
pawn Код:
INI_WriteInt(File,"Skin",PlayerInfo[playerid][pSkin]);
Reply
#8

Sadly that still didnt work
Reply
#9

Ok, what's now the problem? as I see when a player register he get skin 0.Do you have a setskin command?
Reply
#10

Why don't you guys ever post in the thread in which you got it from?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)