17.12.2013, 15:52
Hi.
I am making a license and ticket system for my gamemode and everytime I relog it creates these lines in the save file:
So after 4 logins my save game looks like this:
My code looks like this
I am making a license and ticket system for my gamemode and everytime I relog it creates these lines in the save file:
Код:
Driver License = 0 Commercial License = 0 Tickets = 0 Ticket Total = 0
Код:
Driver License = 0 Commercial License = 0 Tickets = 0 Ticket Total = 0 Driver License = 0 Commercial License = 0 Ticket Total = 0 Driver License = 0 Commercial License = 0 Ticket Total = 0 Driver License = 0 Commercial License = 0 Ticket Total = 0
Код:
forward SaveChar(playerid);
public SaveChar(playerid)
{
if(!IsPlayerConnected(playerid)) return 1;
if(GetPVarInt(playerid, "prelogin") == 1) return print("Did not save, not logged in.");
if(GetPVarInt(playerid, "Quiz") == 1) return print("Did not save, in quiz.");
if(Connected[playerid] != 1) return print("Did not save, not logged in.");
if(AdminDuty[playerid] == 1) return print("Did not save, admin duty.");
GetPlayerPos(playerid, PlayerInfo[playerid][pX], PlayerInfo[playerid][pY], PlayerInfo[playerid][pZ]);
new INI:File = INI_Open(UserPath(playerid));
new Float:hp;
GetPlayerIp(playerid, PlayerInfo[playerid][pIp], 50);
GetPlayerHealth(playerid, hp);
GetPlayerName(playerid, PlayerInfo[playerid][pName], 70);
INI_SetTag(File,"data");
INI_WriteInt(File,"Driver License", PlayerInfo[playerid][pDLicense]);
INI_WriteInt(File,"Commercial License", PlayerInfo[playerid][pCLicense]);
INI_WriteInt(File, "Tickets", PlayerInfo[playerid][pTickets]);
INI_WriteInt(File, "Ticket Total", PlayerInfo[playerid][pTicketstotal]);
INI_Close(File);
new string[100];
format(string, 100, "%s's character has saved successfully.", GetName(playerid));
print(string);
return 1;
}
Код:
forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
INI_Int("Driver License", PlayerInfo[playerid][pDLicense]);
INI_Int("Commercial License", PlayerInfo[playerid][pCLicense]);
INI_Int("Tickets", PlayerInfo[playerid][pTickets]);
INI_Int("Tickets Total", PlayerInfo[playerid][pTicketstotal]);
return 1;
}


