Skin saving messed up... -
Outcast - 06.07.2011
Well, when a player registers, his skin is set to 299 (Claude skin). That loads normally, through SetSpawnInfo. But when a player relogs, his skin is set to 0 (CJ). I don't see why it's not loading. Everything else loads and saves normally, last position and all.
This is how I get the skin so I can save it in SaveStats(playerid) function.
pawn Код:
pInfo[playerid][pSkin] = GetPlayerSkin(playerid);
SaveStats(playerid)
pawn Код:
print("Saving user data..."); // DELETE LATER
djSet(pFile[playerid], "origin", pInfo[playerid][pOrigin]);
djSet(pFile[playerid], "sex", pInfo[playerid][pSex]);
djSetInt(pFile[playerid], "password", udb_hash(pTempPassword[playerid]));
djSetInt(pFile[playerid], "money", pInfo[playerid][pMoney]);
djSetInt(pFile[playerid], "level", pInfo[playerid][pLevel]);
djSetInt(pFile[playerid], "age", pInfo[playerid][pAge]);
djSetInt(pFile[playerid], "respect", pInfo[playerid][pRespect]);
djSetInt(pFile[playerid], "respectrequired", pInfo[playerid][pRespectRequired]);
djSetInt(pFile[playerid], "gaminghours", pInfo[playerid][pGamingHours]);
djSetInt(pFile[playerid], "primaryweapon", pInfo[playerid][pPrimaryWeapon]);
djSetInt(pFile[playerid], "primaryweaponammo", pInfo[playerid][pPrimaryWeaponAmmo]);
djSetInt(pFile[playerid], "secondaryweapon", pInfo[playerid][pSecondaryWeapon]);
djSetInt(pFile[playerid], "secondaryweaponammo", pInfo[playerid][pSecondaryWeaponAmmo]);
djSetInt(pFile[playerid], "meeleeweapon", pInfo[playerid][pMeeleeWeapon]);
djSetInt(pFile[playerid], "specialweapon", pInfo[playerid][pSpecialWeapon]);
djSetInt(pFile[playerid], "specialweaponammo", pInfo[playerid][pSpecialWeaponAmmo] );
djSetInt(pFile[playerid], "skin", pInfo[playerid][pSkin]);
djSetInt(pFile[playerid], "admin", pAdmin[playerid]);
djSetInt(pFile[playerid], "adminduty", pAdminDuty[playerid]);
djSetInt(pFile[playerid], "onduty", pOnDuty[playerid]);
djSetInt(pFile[playerid], "tutorialpassed", pInfo[playerid][pTutorialPassed]);
djSetFloat(pFile[playerid], "health", pInfo[playerid][pHealth]);
djSetFloat(pFile[playerid], "armor", pInfo[playerid][pArmor]);
djSetFloat(pFile[playerid], "spawnx", pInfo[playerid][pSpawnX]);
djSetFloat(pFile[playerid], "spawny", pInfo[playerid][pSpawnY]);
djSetFloat(pFile[playerid], "spawnz", pInfo[playerid][pSpawnZ]);
djSetFloat(pFile[playerid], "spawnr", pInfo[playerid][pSpawnR]);
print("All data saved"); // DELETE LATER
And this is SetSpawnInfo that I use OnDialogRespond on login and register.
pawn Код:
SetSpawnInfo(playerid, 0, pInfo[playerid][pSkin], pInfo[playerid][pSpawnX], pInfo[playerid][pSpawnY], pInfo[playerid][pSpawnZ], pInfo[playerid][pSpawnR], 0, 0, 0, 0, 0, 0);
I don't see what's wrong there... :/
Re: Skin saving messed up... -
iTzZh - 06.07.2011
I see you're saving the skin properly but are you loading the skin properly from the file?
Re: Skin saving messed up... -
Donya - 06.07.2011
moved below
Re: Skin saving messed up... -
Outcast - 06.07.2011
Okay, here's the LoadStats func.
pawn Код:
print("Loading files..."); // DELETE LATER
format(pInfo[playerid][pOrigin], 14, "%s", dj(pFile[playerid], "origin"));
format(pInfo[playerid][pSex], 7, "%s", dj(pFile[playerid], "sex"));
pTempPassword[playerid] = djInt(pFile[playerid], "password");
pInfo[playerid][pMoney] = djInt(pFile[playerid], "money");
pInfo[playerid][pLevel] = djInt(pFile[playerid], "level");
pInfo[playerid][pAge] = djInt(pFile[playerid], "age");
pInfo[playerid][pRespect] = djInt(pFile[playerid], "respect");
pInfo[playerid][pRespectRequired] = djInt(pFile[playerid], "respectrequired");
pInfo[playerid][pGamingHours] = djInt(pFile[playerid], "gaminghours");
pInfo[playerid][pPrimaryWeapon] = djInt(pFile[playerid], "primaryweapon");
pInfo[playerid][pPrimaryWeaponAmmo] = djInt(pFile[playerid], "primaryweaponammo");
pInfo[playerid][pSecondaryWeapon] = djInt(pFile[playerid], "secondaryweapon");
pInfo[playerid][pSecondaryWeaponAmmo] = djInt(pFile[playerid], "secondaryweaponammo");
pInfo[playerid][pMeeleeWeapon] = djInt(pFile[playerid], "meeleeweapon");
pInfo[playerid][pSpecialWeapon] = djInt(pFile[playerid], "specialweapon");
pInfo[playerid][pSpecialWeaponAmmo] = djInt(pFile[playerid], "specialweaponammo");
pInfo[playerid][pSkin] = djInt(pFile[playerid], "skin");
pAdmin[playerid] = djInt(pFile[playerid], "admin");
pAdminDuty[playerid] = djInt(pFile[playerid], "adminduty");
pOnDuty[playerid] = djInt(pFile[playerid], "onduty");
pInfo[playerid][pTutorialPassed] = djInt(pFile[playerid], "tutorialpassed");
pInfo[playerid][pHealth] = djFloat(pFile[playerid], "health");
pInfo[playerid][pArmor] = djFloat(pFile[playerid], "armor");
pInfo[playerid][pSpawnX] = djFloat(pFile[playerid], "spawnx");
pInfo[playerid][pSpawnY] = djFloat(pFile[playerid], "spawny");
pInfo[playerid][pSpawnZ] = djFloat(pFile[playerid], "spawnz");
pInfo[playerid][pSpawnR] = djFloat(pFile[playerid], "spawnr");
print("Files loaded.");
print("Loaded skin id is...");
print(pInfo[playerid][pSkin]);
Also, after relogging, in my userfile under skin it says:
And this is under dialog respond, for login:
pawn Код:
if(djInt(pFile[playerid], "password") == udb_hash(inputtext)){
LoadStats(playerid);
SetSpawnInfo(playerid, 0, pInfo[playerid][pSkin], pInfo[playerid][pSpawnX], pInfo[playerid][pSpawnY], pInfo[playerid][pSpawnZ], pInfo[playerid][pSpawnR], 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);
pLoggedIn[playerid] = true;
format(message, sizeof(message), "Welcome back %s, you successfuly logged in.", pName[playerid]);
SendClientMessage(playerid,INFO_COLOR, message);
//if(pInfo[playerid][pTutorialPassed] == 0)
}
EDIT: Donya, I tried your way, doesn't work neither. In my scriptfiles my skin is saved as "skin":1634496613
Re: Skin saving messed up... -
Donya - 06.07.2011
pawn Код:
djSetInt(pFile[playerid], "skin", GetPlayerSkin(playerid));
pInfo[playerid][pSkin] = GetPlayerSkin(playerid);
Re: Skin saving messed up... -
Outcast - 06.07.2011
Doesn't work, same shit. I don't get it, fucking crap won't work and it should be the most simplest thing anyone can do. Fuck... :SS fucking skins, I always had trouble saving them. Any other suggestions?
Re: Skin saving messed up... -
Donya - 06.07.2011
when are you saving. onplayerdisconnect?
Re: Skin saving messed up... -
Outcast - 06.07.2011
Yes
...........
Re: Skin saving messed up... -
Donya - 06.07.2011
save it at setplayerskin...
or when they choose a skin.
Re: Skin saving messed up... -
Steven82 - 06.07.2011
Um, try to create a custom callback using "forward" and then move everything your saving on OnPlayerDisconnect into the callback. Now under OnPlayerDisconnect, put the custom callback name like "SavePlayerAccount(playerid);" What ever is in your forward, use that.