Help with my saving forward only saves for 1 person - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Help with my saving forward only saves for 1 person (
/showthread.php?tid=270337)
Help with my saving forward only saves for 1 person -
slymatt - 20.07.2011
This only saves for one person could anyone tell me why.
Код:
public SaveStats(playerid)
{
for(new save=0;save<MAX_PLAYERS;save++)
{
if(INI_Open(getINI(playerid))) {
SendClientMessage(playerid, COLOUR_YELLOW, "SAVED!");
new Float:x, Float:y, Float:z, Float:a;
GetPlayerPos(playerid, x, y, z);
GetPlayerFacingAngle(playerid, a);
//INI_WriteInt("Age",PlayerInfo[playerid][Age]);
INI_WriteInt("Cash", GetPlayerMoney(playerid));
INI_WriteInt("Score", GetPlayerScore(playerid));
INI_WriteInt("Skin",GetPlayerSkin(playerid));
INI_WriteInt("Kills", killer[playerid]);
INI_WriteInt("Deaths", died[playerid]);
//INI_WriteInt("Timepalyed",PlayerInfo[playerid][Timeplayed]);
//INI_WriteString("Ipaddress",PlayerInfo[playerid][Ipaddress]);
INI_WriteFloat("Savedpositionx", x);
INI_WriteFloat("Savedpositiony", y);
INI_WriteFloat("Savedpositionz", z);
INI_WriteFloat("Savedpositiona", a);
INI_WriteInt("playersInterior", GetPlayerInterior(playerid));
INI_WriteInt("playersVworld", GetPlayerVirtualWorld(playerid));
INI_WriteInt("Admin",PlayerInfo[playerid][Admin]);
//INI_WriteInt("Faction",PlayerInfo[playerid][Faction]);
//INI_WriteInt("Factionrank",PlayerInfo[playerid][Factionrank]);
//INI_WriteInt("Bankdeposit",PlayerInfo[playerid][Bankdeposit]);
//INI_WriteInt("Banned",PlayerInfo[playerid][Banned]);
//INI_WriteString("Banreason",PlayerInfo[playerid][Banreason]);
//INI_WriteInt("House",PlayerInfo[playerid][House]);
//INI_WriteInt("Biz",PlayerInfo[playerid][Biz]);
//INI_WriteInt("Fightstyle",PlayerInfo[playerid][Fightstyle]);
//INI_WriteInt("Walkstyle", PlayerInfo[playerid][Walkstyle]);
//INI_WriteInt("TimesArrested", PlayerInfo[playerid][TimesArrested]);
//INI_WriteInt("Drivinglicense", PlayerInfo[playerid][Drivinglicense]);
//INI_WriteInt("Flyinglicense", PlayerInfo[playerid][Flyinglicense]);
//INI_WriteInt("Boatlicense", PlayerInfo[playerid][Boatlicense]);
//INI_WriteInt("GunLicense", PlayerInfo[playerid][Gunlicense]);
//INI_WriteInt("Car", PlayerInfo[playerid][Car]);
//INI_WriteInt("Job", PlayerInfo[playerid][Job]);
//INI_WriteInt("Earnings", PlayerInfo[playerid][Earnings]);
INI_Save();
INI_Close();
}
}
Thanks alot for replys
Re: Help with my saving forward only saves for 1 person -
[HiC]TheKiller - 20.07.2011
You are only saving for the playerid that has been given in the SaveStats argument. What you would need to do is take out the playerid argument and do this
pawn Код:
public SaveStats()
{
for(new playerid=0;playerid<MAX_PLAYERS;playerid++)
{
if(INI_Open(getINI(playerid))) {
SendClientMessage(playerid, COLOUR_YELLOW, "SAVED!");
new Float:x, Float:y, Float:z, Float:a;
GetPlayerPos(playerid, x, y, z);
GetPlayerFacingAngle(playerid, a);
//INI_WriteInt("Age",PlayerInfo[playerid][Age]);
INI_WriteInt("Cash", GetPlayerMoney(playerid));
INI_WriteInt("Score", GetPlayerScore(playerid));
INI_WriteInt("Skin",GetPlayerSkin(playerid));
INI_WriteInt("Kills", killer[playerid]);
INI_WriteInt("Deaths", died[playerid]);
//INI_WriteInt("Timepalyed",PlayerInfo[playerid][Timeplayed]);
//INI_WriteString("Ipaddress",PlayerInfo[playerid][Ipaddress]);
INI_WriteFloat("Savedpositionx", x);
INI_WriteFloat("Savedpositiony", y);
INI_WriteFloat("Savedpositionz", z);
INI_WriteFloat("Savedpositiona", a);
INI_WriteInt("playersInterior", GetPlayerInterior(playerid));
INI_WriteInt("playersVworld", GetPlayerVirtualWorld(playerid));
INI_WriteInt("Admin",PlayerInfo[playerid][Admin]);
//INI_WriteInt("Faction",PlayerInfo[playerid][Faction]);
//INI_WriteInt("Factionrank",PlayerInfo[playerid][Factionrank]);
//INI_WriteInt("Bankdeposit",PlayerInfo[playerid][Bankdeposit]);
//INI_WriteInt("Banned",PlayerInfo[playerid][Banned]);
//INI_WriteString("Banreason",PlayerInfo[playerid][Banreason]);
//INI_WriteInt("House",PlayerInfo[playerid][House]);
//INI_WriteInt("Biz",PlayerInfo[playerid][Biz]);
//INI_WriteInt("Fightstyle",PlayerInfo[playerid][Fightstyle]);
//INI_WriteInt("Walkstyle", PlayerInfo[playerid][Walkstyle]);
//INI_WriteInt("TimesArrested", PlayerInfo[playerid][TimesArrested]);
//INI_WriteInt("Drivinglicense", PlayerInfo[playerid][Drivinglicense]);
//INI_WriteInt("Flyinglicense", PlayerInfo[playerid][Flyinglicense]);
//INI_WriteInt("Boatlicense", PlayerInfo[playerid][Boatlicense]);
//INI_WriteInt("GunLicense", PlayerInfo[playerid][Gunlicense]);
//INI_WriteInt("Car", PlayerInfo[playerid][Car]);
//INI_WriteInt("Job", PlayerInfo[playerid][Job]);
//INI_WriteInt("Earnings", PlayerInfo[playerid][Earnings]);
INI_Save();
INI_Close();
}
}
Re: Help with my saving forward only saves for 1 person -
slymatt - 20.07.2011
Works 100% thanks alot mate