Skins Not Saving
#1

Hi,

I am coding a custom Game-Mode but I have encountered a problem. I do not get any warnings or errors so I presume there's no coding error, Maybe its the way I save it.

I have made a "Binco" Dialog where the player can purchase skins. The line below is what happens when a player chooses a skin:

Код:
SetPlayerSkin(playerid, 143);
GivePlayerMoney(playerid, -200);
INI_WriteInt("Skin", 143);
SendClientMessage(playerid, COLOR_WHITE, "Binco: Enjoy Your New Look!");
SendClientMessage(playerid, COLOR_YELLOW, "----------");
SendClientMessage(playerid, COLOR_WHITE, "> {FF0000}Receipt{FFFFFF} <");
SendClientMessage(playerid, COLOR_WHITE, " ");
SendClientMessage(playerid, COLOR_WHITE, "> Shop: Binco");
SendClientMessage(playerid, COLOR_WHITE, "> Total Items: 1");
SendClientMessage(playerid, COLOR_WHITE, "> Total Price: $200");
SendClientMessage(playerid, COLOR_YELLOW, "----------");
return 1;
// Male - 143
I also save the players data in a folder called 'Users' in Scriptfiles.

Код:
public OnPlayerDisconnect(playerid, reason)
{
    SaveCharacter(playerid);
	return 1;
}
And The Save Character Function:

Код:
stock SaveCharacter(playerid)
{
    if(INI_Open(GetUser(playerid)))
    {
        INI_WriteInt("Money",GetPlayerMoney(playerid));
        INI_WriteInt("Score",GetPlayerScore(playerid));
        INI_WriteInt("Skin",PlayerInfo[playerid][Skin]);
        INI_WriteFloat("Health",GetPlayerHealth(playerid, PlayerInfo[playerid][Health]));
        INI_WriteFloat("Armour",GetPlayerArmour(playerid, PlayerInfo[playerid][Armour]));
        INI_WriteInt("Administrator",PlayerInfo[playerid][Administrator]);
        INI_WriteInt("AdminLevel",PlayerInfo[playerid][AdminLevel]);
        INI_WriteInt("TutorialCompleted",PlayerInfo[playerid][TutorialCompleted]);
        GetPlayerPos(playerid, PlayerInfo[playerid][pX], PlayerInfo[playerid][pY], PlayerInfo[playerid][pZ]);
        INI_WriteFloat("pX",PlayerInfo[playerid][pX]);
        INI_WriteFloat("pY",PlayerInfo[playerid][pY]);
        INI_WriteFloat("pZ",PlayerInfo[playerid][pZ]);
        INI_Save();
        INI_Close();
    }
   	return 1;
}
Everything works, saves and loads, Even the score for example but the Skins isn't loading anymore. I have fixed this problem before but this time, Its got the better off me. :/

EDIT: I also checked to see if the loading was working and it was. ( I set the skin through Scriptfiles/Users and set it to 104, It loaded up as 104 ).
Reply
#2

Instead of
Код:
INI_WriteInt("Skin", 143);
set the skin variable to 143.
Reply
#3

try this
pawn Код:
SetPlayerSkin(playerid, 143);
PlayerInfo[playerid][Skin] = 143;
GivePlayerMoney(playerid, -200);
INI_WriteInt("Skin", 143);
SendClientMessage(playerid, COLOR_WHITE, "Binco: Enjoy Your New Look!");
SendClientMessage(playerid, COLOR_YELLOW, "----------");
SendClientMessage(playerid, COLOR_WHITE, "> {FF0000}Receipt{FFFFFF} <");
SendClientMessage(playerid, COLOR_WHITE, " ");
SendClientMessage(playerid, COLOR_WHITE, "> Shop: Binco");
SendClientMessage(playerid, COLOR_WHITE, "> Total Items: 1");
SendClientMessage(playerid, COLOR_WHITE, "> Total Price: $200");
SendClientMessage(playerid, COLOR_YELLOW, "----------");
return 1;
// Male - 143
Reply
#4

Will Do Now, Thanks For The Replies.

EDIT: Fixed that problem, Thanks a bunch.
Reply


Forum Jump:


Users browsing this thread: