Saving skin on gmx (y_ini)
#1

Hey guys, i have a problem and i think you already know about that.When you register and disconnect, skin will be saved, but if you gmx, the skin will reset to 0 (CJ), i think you understand me i can't find solution for this. I'm using Kush's register system (y_ini), thanks in advance.
Reply
#2

https://sampforum.blast.hk/showthread.php?tid=250369
Reply
#3

Quote:

Tried this include, but the commands ain't working at all. Nothing happens. It just tells me that the command is called, but nothing happens. Any idea why? Is it not working with today's version of sa-mp?

That's your post and i have that problem now...
Reply
#4

Quote:
Originally Posted by Kolten
Посмотреть сообщение
That's your post and i have that problem now...
Yes I am aware of that, but I wasn't sure if that was only caused by my script. Apparently it isn't, then.
Reply
#5

Do like this :-
Код:
new skin[MAX_PLAYERS];
then this :-
Код:
public loadaccount_user(playerid, name[], value[])
{
INI_Int("Skin",skin[playerid]);
SetPlayerSkin(playerid,skin[playerid]) 
return 1;
}
Here add your normal load user code with this INI_Int("Skin",skin[playerid]);
Код:
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");
INI_WriteInt(File,"Skin",0);
 }
        }
use normal code of kuch with INI_WriteInt(File,"Skin",0);
Almost done
Код:
       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]);
                    ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"You have successfully logged in!","Ok","");
                    SetPlayerSkin(playerid,skin[playerid]);
                }
                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;
}
Loads the skin when player connects
Код:
public OnPlayerDisconnect(playerid, reason)
{
    skin[playerid] = GetPlayerSkin(playerid);
    INI_WriteInt(File,"Skin",skin[playerid]);
    return 1;
}
Add your normal code with "skin[playerid] = GetPlayerSkin(playerid);"
and "INI_WriteInt(File,"Skin",skin[playerid]);"

If you get any error then tell me i didn't tested it
Reply
#6

Quote:
Originally Posted by Dark Killer
Посмотреть сообщение
Do like this :
Much effort for nothing. OP already has the code working, it's just that OnPlayerDisconnect isn't called on /gmx.
Reply
#7

Quote:
Originally Posted by ******
Посмотреть сообщение
Can you not just call the save function from OnGameModeExit?
Код:
public OnGameModeExit()
{
        foreach(Player, i)
        {
            SavePlayerAccount(i);
        }
        return 1;
}

public SavePlayerAccount(playerid)
{
        new money = GetPlayerMoney(playerid);
	new skin = GetPlayerSkin(playerid);
	new level = GetPlayerScore(playerid);
	if(fexist(UserPath(playerid)))
	{
		new INI:File = INI_Open(UserPath(playerid));
		INI_SetTag(File," Balkan Force RolePlay ");
		INI_WriteInt(File,"Money",money);
		INI_WriteInt(File,"Skin",skin);
		INI_WriteInt(File,"Level",level);
		INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
		INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
		INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
		INI_WriteInt(File,"Sex",PlayerInfo[playerid][pSex]);
		INI_WriteInt(File,"Age",PlayerInfo[playerid][pAge]);
		INI_WriteInt(File,"Registered",PlayerInfo[playerid][pRegistered]);
		INI_WriteInt(File,"GunID",PlayerInfo[playerid][pGunID]);
		INI_WriteInt(File,"GunAmmo",PlayerInfo[playerid][pGunAmmo]);
		INI_Close(File);
	}
	return 1;
}
still nothing...
Reply
#8

BUMP...any solution for this?
Reply
#9

Hmm, can you show us your UserPath function and all associated macros/variables?
Reply
#10

Код:
//this is in Login dialog
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);

stock UserPath(playerid)
{
    new string[128],playername[MAX_PLAYER_NAME];
    GetPlayerName(playerid,playername,sizeof(playername));
    format(string,sizeof(string),PATH,playername);
    return string;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)