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