[AJUDA]Nгo carrega valor. -
Inflamate - 18.04.2012
Eu estava terminando meu sistema de registro, deu bug dele nгo salvar skin.. atй aн tudo bem, resolvi. Agora ele nгo carrega. x_x O Cуdigo todo relacionado ao sistema de registro do meu GM abaixo \/
Code:
enum pInfo
{
Pass[129],
Cash,
Level,
Exp,
Skin,
Online
};
new Skin2[MAX_PLAYERS];
Code:
public OnPlayerRequestClass(playerid, classid)
{
SetSpawnInfo(playerid, Skin2[playerid], 0, PosX[playerid],PosY[playerid],PosZ[playerid],Angle[playerid],0,0,0,0,0,0);
SpawnPlayer(playerid);
SetPVarInt(playerid, "Joinned", 1);
return 1;
}
Code:
public LoadUserData(playerid, name[], value[])
{
INI_String("Password", PlayerInfo[playerid][Pass], 129);
INI_Int("Money", PlayerInfo[playerid][Cash]);
INI_Int("Level", PlayerInfo[playerid][Level]);
INI_Int("Exp", PlayerInfo[playerid][Exp]);
INI_Int("Online", PlayerInfo[playerid][Online]);
INI_Int("Skin", Skin2[playerid]);
INI_Float("X", PosX[playerid]);
INI_Float("Y", PosY[playerid]);
INI_Float("Z", PosZ[playerid]);
INI_Float("Angle", Angle[playerid]);
return 1;
}
Code:
stock OnPlayerRegister(playerid, password[])
{
new
hashPassword[129],
uFile[35];
format(uFile, 35, USER_FILE, GetName(playerid));
new
INI:playerFile = INI_Open(uFile);
WP_Hash(hashPassword, 129, password);
INI_WriteString(playerFile, "Password", hashPassword);
INI_WriteInt(playerFile, "Money", 0);
INI_WriteInt(playerFile, "Level", 0);
INI_WriteInt(playerFile, "Exp", 0);
INI_WriteInt(playerFile, "Online", 0);
INI_WriteInt(playerFile, "Skin", 0);
INI_WriteFloat(playerFile, "X", 1715.2522);
INI_WriteFloat(playerFile, "Y", -1878.4022);
INI_WriteFloat(playerFile, "Z", 13.5665);
INI_WriteFloat(playerFile, "Angle", 0.7316);
PosX[playerid] = 1715.2522;
PosY[playerid] = -1878.4022;
PosZ[playerid] = 13.5665;
Angle[playerid] = 0.7316;
PlayerInfo[playerid][Level] = 1;
PlayerInfo[playerid][Skin] = 0;
INI_Close(playerFile);
SetPVarInt(playerid, "Registrado", 1);
SetPVarInt(playerid, "Logado", 1);
return 1;
}
Code:
stock OnPlayerLogin(playerid, password[])
{
new
hashPassword[129],
uFile[35];
format(uFile, 35, USER_FILE, GetName(playerid));
INI_ParseFile(uFile, "LoadUserData", .bExtra = true, .extra = playerid);
WP_Hash(hashPassword, 129, password);
if(strcmp(PlayerInfo[playerid][Pass], hashPassword, false))
{
{
SetPVarInt(playerid, "Logado", 1);
}
}
return 1;
}
Code:
stock OnPlayerLogout(playerid)
{
new
uFile[35];
format(uFile, 35, USER_FILE, GetName(playerid));
new
INI:playerFile = INI_Open(uFile);
GetPlayerPos(playerid, PosX[playerid], PosY[playerid], PosZ[playerid]);
GetPlayerFacingAngle(playerid, Angle[playerid]);
PlayerInfo[playerid][Skin] = GetPlayerSkin(playerid);
INI_WriteInt(playerFile, "Money", GetPlayerMoney(playerid));
INI_WriteInt(playerFile, "Level", PlayerInfo[playerid][Level]);
INI_WriteInt(playerFile, "Exp", PlayerInfo[playerid][Exp]);
INI_WriteInt(playerFile, "Online", PlayerInfo[playerid][Online]);
INI_WriteInt(playerFile, "Skin", PlayerInfo[playerid][Skin]);
INI_WriteFloat(playerFile, "X", PosX[playerid]);
INI_WriteFloat(playerFile, "Y", PosY[playerid]);
INI_WriteFloat(playerFile, "Z", PosZ[playerid]);
INI_WriteFloat(playerFile, "Angle", Angle[playerid]);
INI_Close(playerFile);
return 1;
}
O Valor da skin fica salva no arquivo, mas nгo й carregado. Esse й o problema. x_x
Re: [AJUDA]Nгo carrega valor. -
Joker_OutLock - 19.04.2012
pawn Code:
public LoadUserData(playerid, name[], value[])
{
INI_String("Password", PlayerInfo[playerid][Pass], 129);
INI_Int("Money", PlayerInfo[playerid][Cash]);
INI_Int("Level", PlayerInfo[playerid][Level]);
INI_Int("Exp", PlayerInfo[playerid][Exp]);
INI_Int("Online", PlayerInfo[playerid][Online]);
INI_Int("Skin", SetPlayerSkin(playerid));
INI_Float("X", PosX[playerid]);
INI_Float("Y", PosY[playerid]);
INI_Float("Z", PosZ[playerid]);
INI_Float("Angle", Angle[playerid]);
return 1;
}