24.01.2011, 16:35
(
Last edited by Mean; 28/01/2011 at 11:35 AM.
Reason: Because it's solved
)
SOLVED
stock LoadStats(playerid, name[], value[])
{
if(!strcmp(name, "Cash")) GivePlayerMoney(playerid, strval(value));
if(!strcmp(name, "Score")) SetPlayerScore(playerid, strval(value));
if(!strcmp(name, "Level")) PInfo[playerid][Level] = strval(value);
if(!strcmp(name, "Kills")) PInfo[playerid][Kills] = strval(value);
if(!strcmp(name, "Deaths")) PInfo[playerid][Deaths] = strval(value);
}
INI_Int("Cash", PInfo[playerid][Cash]);
GivePlayerMoney(playerid, PInfo[playerid][Cash]);
INI_Int("Score", PInfo[playerid][Score]);
SetPlayerScore(playerid, PInfo[playerid][Score]);
INI_Int("Level", PInfo[playerid][Level]);
INI_Int("Kills", PInfo[playerid][Kills]);
INI_Int("Deaths", PInfo[playerid][Deaths]);
Replace the contents of your LoadStats with this. You probably will have to add Cash and Score to your PInfo enum:
pawn Code:
|
public LoadStats(playerid, name[], value[])
{
if(!strcmp(name, "Cash"))
{
PInfo[playerid][Cash] = strval(value);
ResetPlayerMoney(playerid);
GivePlayerMoney(playerid, PInfo[playerid][Cash]);
}
if(!strcmp(name, "Score"))
{
PInfo[playerid][Score] = strval(value);
SetPlayerScore(playerid, PInfo[playerid][Score]);
}
if(!strcmp(name, "Level"))
{
PInfo[playerid][Level] = strval(value);
}
if(!strcmp(name, "Kills"))
{
PInfo[playerid][Kills] = strval(value);
}
if(!strcmp(name, "Deaths"))
{
PInfo[playerid][Deaths] = strval(value);
}
return 1;
}
INI_ParseFile(file, "LoadStats", false, true, playerid);
format(...);
INI_ParseFile(...);