Skin saving error -
STONEGOLD - 01.06.2015
Hi, I'm using this for first time spawn. But it spawns me Cj skin. Any idea how to fix it.
PHP код:
PlayerInfo[playerid][Skin] = 0;
INI_WriteInt(ufile, "Skin", GetPlayerSkin(playerid));
Re: Skin saving error -
SoFahim - 01.06.2015
I think it might be like this
Код:
PlayerInfo[Playerid][Skin] = skinid;
Re: Skin saving error -
STONEGOLD - 01.06.2015
Nope, It's not like this and doesn't work too. Anyone help please? would be nice if you guyz help me fast.
Re: Skin saving error -
Stanford - 01.06.2015
Show us how you read the data you saved and we might be able to help you!
Re: Skin saving error -
Bennyy - 01.06.2015
GetPlayerSkin(playerid)) - try using that however we would need to know how your reading and saving your data to show you a snippet of code you could use
Re: Skin saving error -
sscarface - 01.06.2015
use -1
Re: Skin saving error -
STONEGOLD - 01.06.2015
PHP код:
enum user
{
pPass[129],
aLevel,
vLevel,
pCash,
pScore,
pKills,
pDeaths,
pHoldups,
pCrimes,
pFined,
pArrests,
pTakedowns,
pTickets,
pRope,
pPaintCan,
pScissors,
pKits,
vLock,
Helper,
hHelper,
pWarns,
pKicks,
pJoins,
pMaterials,
Banned,
jTime,
Float:pArmour,
Float:pHealth,
pWanted,
cTime,
pSkin
}
new PlayerInfo[MAX_PLAYERS][user];
PHP код:
stock SaveUserStats(playerid)
{
if(IsPlayerConnected(playerid) && IsLoggedIn{playerid} == 1)
{
new file[40];
new score = GetPlayerScore(playerid), cash = GetPlayerCash(playerid), wanted = GetPlayerWantedLevel(playerid), jail = JailTime[playerid], cage = CageTime[playerid];
new Float:armour, Float:health;
GetPlayerHealth(playerid, health);
GetPlayerArmour(playerid, armour);
PlayerInfo[playerid][pScore] = score;
PlayerInfo[playerid][pCash] = cash;
PlayerInfo[playerid][pWanted] = wanted;
PlayerInfo[playerid][pArmour] = armour;
PlayerInfo[playerid][pHealth] = armour;
PlayerInfo[playerid][jTime] = jail;
PlayerInfo[playerid][cTime] = cage;
GetPlayerArmour(playerid, armour);
format(file, sizeof(file), USER_FILE, GetName(playerid));
new INI:ufile = INI_Open(file);
INI_WriteString(ufile, "pPass", PlayerInfo[playerid][pPass]);
INI_WriteInt(ufile, "aLevel",PlayerInfo[playerid][aLevel]);
INI_WriteInt(ufile, "vLevel",PlayerInfo[playerid][vLevel]);
INI_WriteInt(ufile, "pCash", cash);
INI_WriteInt(ufile, "pScore", score);
INI_WriteInt(ufile, "pKills", PlayerInfo[playerid][pKills]);
INI_WriteInt(ufile, "pDeaths", PlayerInfo[playerid][pDeaths]);
INI_WriteInt(ufile, "pHoldups", PlayerInfo[playerid][pHoldups]);
INI_WriteInt(ufile, "pCrimes", PlayerInfo[playerid][pCrimes]);
INI_WriteInt(ufile, "pFined", PlayerInfo[playerid][pFined]);
INI_WriteInt(ufile, "pArrests", PlayerInfo[playerid][pArrests]);
INI_WriteInt(ufile, "pTakedowns", PlayerInfo[playerid][pTakedowns]);
INI_WriteInt(ufile, "pTickets", PlayerInfo[playerid][pTickets]);
INI_WriteInt(ufile, "pRope", PlayerInfo[playerid][pRope]);
INI_WriteInt(ufile, "pPaintCan", PlayerInfo[playerid][pPaintCan]);
INI_WriteInt(ufile, "pScissors", PlayerInfo[playerid][pScissors]);
INI_WriteInt(ufile, "pKits", PlayerInfo[playerid][pKits]);
INI_WriteInt(ufile, "vLock", PlayerInfo[playerid][vLock]);
INI_WriteInt(ufile, "Helper", PlayerInfo[playerid][Helper]);
INI_WriteInt(ufile, "hHelper", PlayerInfo[playerid][hHelper]);
INI_WriteInt(ufile, "pWarns", PlayerInfo[playerid][pWarns]);
INI_WriteInt(ufile, "pKicks", PlayerInfo[playerid][pKicks]);
INI_WriteInt(ufile, "pJoins", PlayerInfo[playerid][pJoins]);
INI_WriteInt(ufile, "pMaterials", PlayerInfo[playerid][pMaterials]);
INI_WriteInt(ufile, "Banned", PlayerInfo[playerid][Banned]);
INI_WriteInt(ufile, "jTime", jail);
INI_WriteFloat(ufile, "pArmour", armour);
INI_WriteFloat(ufile, "pHealth", health);
INI_WriteInt(ufile, "pWanted", wanted);
INI_WriteInt(ufile, "cTime", cage);
INI_WriteInt(ufile, "pSkin", GetPlayerSkin(playerid));
INI_Close(ufile);
}
return 1;
}
PHP код:
PlayerInfo[playerid][aLevel] = 0;
PlayerInfo[playerid][vLevel] = 0;
PlayerInfo[playerid][pCash] = 10000;
PlayerInfo[playerid][pScore] = 0;
PlayerInfo[playerid][pKills] = 0;
PlayerInfo[playerid][pDeaths] = 0;
PlayerInfo[playerid][pHoldups] = 0;
PlayerInfo[playerid][pCrimes] = 0;
PlayerInfo[playerid][pFined] = 0;
PlayerInfo[playerid][pArrests] = 0;
PlayerInfo[playerid][pTakedowns] = 0;
PlayerInfo[playerid][pTickets] = 0;
PlayerInfo[playerid][pRope] = 0;
PlayerInfo[playerid][pPaintCan] = 0;
PlayerInfo[playerid][pScissors] = 0;
PlayerInfo[playerid][pKits] = 0;
PlayerInfo[playerid][vLock] = 0;
PlayerInfo[playerid][Helper] = 0;
PlayerInfo[playerid][hHelper] = 0;
PlayerInfo[playerid][pWarns] = 0;
PlayerInfo[playerid][pKicks] = 0;
PlayerInfo[playerid][pJoins] = 1;
PlayerInfo[playerid][pArrests] = 0;
PlayerInfo[playerid][pMaterials] = 0;
PlayerInfo[playerid][Banned] = 0;
PlayerInfo[playerid][jTime] = 0;
PlayerInfo[playerid][pWanted] = 0;
PlayerInfo[playerid][pArmour] = 0.0;
PlayerInfo[playerid][pHealth] = 0.0;
PlayerInfo[playerid][cTime] = 0;
PlayerInfo[playerid][pSkin] = 0;
new INI:ufile = INI_Open(userfile);
INI_WriteInt(ufile, "aLevel",PlayerInfo[playerid][aLevel]);
INI_WriteInt(ufile, "vLevel",PlayerInfo[playerid][vLevel]);
INI_WriteInt(ufile, "pCash", PlayerInfo[playerid][pCash]);
INI_WriteInt(ufile, "pScore", PlayerInfo[playerid][pScore]);
INI_WriteInt(ufile, "pKills", PlayerInfo[playerid][pKills]);
INI_WriteInt(ufile, "pDeaths", PlayerInfo[playerid][pDeaths]);
INI_WriteInt(ufile, "pHoldups", PlayerInfo[playerid][pHoldups]);
INI_WriteInt(ufile, "pCrimes", PlayerInfo[playerid][pCrimes]);
INI_WriteInt(ufile, "pFined", PlayerInfo[playerid][pFined]);
INI_WriteInt(ufile, "pArrests", PlayerInfo[playerid][pArrests]);
INI_WriteInt(ufile, "pTakedowns", PlayerInfo[playerid][pTakedowns]);
INI_WriteInt(ufile, "pTickets", PlayerInfo[playerid][pTickets]);
INI_WriteInt(ufile, "pRope", PlayerInfo[playerid][pRope]);
INI_WriteInt(ufile, "pPaintCan", PlayerInfo[playerid][pPaintCan]);
INI_WriteInt(ufile, "pScissors", PlayerInfo[playerid][pScissors]);
INI_WriteInt(ufile, "pKits", PlayerInfo[playerid][pKits]);
INI_WriteInt(ufile, "vLock", PlayerInfo[playerid][vLock]);
INI_WriteInt(ufile, "Helper", PlayerInfo[playerid][Helper]);
INI_WriteInt(ufile, "hHelper", PlayerInfo[playerid][hHelper]);
INI_WriteInt(ufile, "pWarns", PlayerInfo[playerid][pWarns]);
INI_WriteInt(ufile, "pKicks", PlayerInfo[playerid][pKicks]);
INI_WriteInt(ufile, "pJoins", PlayerInfo[playerid][pJoins]);
INI_WriteInt(ufile, "pMaterials", PlayerInfo[playerid][pMaterials]);
INI_WriteInt(ufile, "Banned", PlayerInfo[playerid][Banned]);
INI_WriteInt(ufile, "jTime", PlayerInfo[playerid][jTime]);
INI_WriteInt(ufile, "pWanted", PlayerInfo[playerid][pWanted]);
INI_WriteFloat(ufile, "pArmour", PlayerInfo[playerid][pArmour]);
INI_WriteFloat(ufile, "pHealth", PlayerInfo[playerid][pHealth]);
INI_WriteInt(ufile, "cTime", PlayerInfo[playerid][cTime]);
INI_WriteInt(ufile, "pSkin", PlayerInfo[playerid][pSkin]);
INI_Close(ufile);
format(fstr,sizeof(fstr),"{FFFFFF}Welcome to %s!\n\nYour not registered yet, please enter a password below to register:", GetName(playerid));
ShowPlayerDialog(playerid, REGISTER_MENU, DIALOG_STYLE_INPUT, "{FFFFFF} Account Register", fstr, "Register", "Quit");
THIS LINE IS FOR FIRST TIME SPAWN , i mean, for new player reigster but whenever they choose a skin and click on spawn button they spawn with Cj skin cuz of this "PlayerInfo[playerid][pSkin] = 0;" . I don't know what to put here. Anyone help me?
PHP код:
public LoadUser_data(playerid, name[], value[])
{
INI_String("pPass", PlayerInfo[playerid][pPass], 129);
INI_Int("aLevel", PlayerInfo[playerid][aLevel]);
INI_Int("vLevel", PlayerInfo[playerid][vLevel]);
INI_Int("pCash", PlayerInfo[playerid][pCash]);
INI_Int("pScore", PlayerInfo[playerid][pScore]);
INI_Int("pKills", PlayerInfo[playerid][pKills]);
INI_Int("pDeaths", PlayerInfo[playerid][pDeaths]);
INI_Int("pHoldups", PlayerInfo[playerid][pHoldups]);
INI_Int("pCrimes", PlayerInfo[playerid][pCrimes]);
INI_Int("pFined", PlayerInfo[playerid][pFined]);
INI_Int("pArrests", PlayerInfo[playerid][pArrests]);
INI_Int("pTakedowns", PlayerInfo[playerid][pTakedowns]);
INI_Int("pTickets", PlayerInfo[playerid][pTickets]);
INI_Int("pRope", PlayerInfo[playerid][pRope]);
INI_Int("pPaintCan", PlayerInfo[playerid][pPaintCan]);
INI_Int("pScissors", PlayerInfo[playerid][pScissors]);
INI_Int("pKits", PlayerInfo[playerid][pKits]);
INI_Int("vLock", PlayerInfo[playerid][vLock]);
INI_Int("Helper", PlayerInfo[playerid][Helper]);
INI_Int("hHelper", PlayerInfo[playerid][hHelper]);
INI_Int("pJoins", PlayerInfo[playerid][pJoins]);
INI_Int("pMaterials", PlayerInfo[playerid][pMaterials]);
INI_Int("pWarns", PlayerInfo[playerid][pWarns]);
INI_Int("pKicks", PlayerInfo[playerid][pKicks]);
INI_Int("Banned", PlayerInfo[playerid][Banned]);
INI_Int("jTime", PlayerInfo[playerid][jTime]);
INI_Float("pArmour", PlayerInfo[playerid][pArmour]);
INI_Float("pHealth", PlayerInfo[playerid][pHealth]);
INI_Int("pWanted", PlayerInfo[playerid][pWanted]);
INI_Int("cTime", PlayerInfo[playerid][cTime]);
INI_WriteInt(ufile, "pSkin", PlayerInfo[playerid][pSkin]);
return 1;
}
here's my all code.
Re: Skin saving error -
Konstantinos - 01.06.2015
I guess something like that would work assuming you set the skin with the skin ID you have stored to the variable:
pawn Код:
public OnPlayerRequestSpawn(playerid)
{
if (!PlayerInfo[playerid][pSkin]) PlayerInfo[playerid][pSkin] = GetPlayerSkin(playerid);
return 1;
}
I'm not sure if the callback gets the skin correctly but if it doesn't, OnPlayerRequestClass does (just in case).
Re: Skin saving error -
Bennyy - 01.06.2015
if (!PlayerInfo[playerid][pSkin]) PlayerInfo[playerid][pSkin] = GetPlayerSkin(playerid);
return 1;
UNDER OnPlayerRequestClass - should do the trick, MAKESURE YOU HAVE DECLARED IT
Re: Skin saving error -
STONEGOLD - 01.06.2015
Thanks guyz it works. But one thing more. I want if player re-log and when player loggin but don't spawn it should show player skin and don't let players to choose another skin. I mean, It should block players to see another skin on playerrequestclass.