07.01.2012, 18:23
Hello! So I am trying to make a Points system that saves the points in a file to load them again after the player connects. When I try to compile the code is all right, but when I go in-game the file doesn't save at all :/
Here's the code I'm using:
I hope someone can help me...
Here's the code I'm using:
pawn Код:
#include <a_samp>
#include <Dini>
#define MyFile "\\Points\\%s.ini"
new Points[MAX_PLAYERS];
public OnPlayerConnect(playerid)
{
new File[68];
new Name[MAX_PLAYER_NAME];
GetPlayerName(playerid, Name, sizeof(Name));
format(File, sizeof(File), MyFile, Name);
if(!dini_Exists(File))
{
dini_Create(File);
dini_Set(File, "Name", Name);
dini_IntSet(File, "Points", 0);
Points[playerid] = dini_Int(File, "Points");
}
else
Points[playerid] = dini_Int(File, "Points");
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
new File[68];
new Name[MAX_PLAYER_NAME];
GetPlayerName(playerid, Name , sizeof(Name));
format(File, sizeof(File) , MyFile , Name);
dini_IntSet(File, "Points" , Points[playerid]);
Points[playerid] = 0;
return 1;