15.10.2011, 22:56
Hello, I got a little problem using the file system: SII
but this just doesn't work...
in the directory there are 3 files created:
%s
'empty name'
and
'Playername' (wich is correct)
when I open that file it says kilometers driven: 0,
while I already drove 4 kms, and I checked it with a selfmade command to check the pKMs variable...
any help??
pawn Код:
public OnPlayerConnect(playerid)
{
new file[200],
name[24];
format(file,sizeof(file),"LuxKnack/TeamStats/%s.ini",name);
INI_Open(file);
pKMs[playerid] = INI_ReadInt("KMDriven");
INI_Close();
pawn Код:
public CountDistance(vehicleid)
{
new string[69];
for(new i = 0;i < MAX_PLAYERS;i++)
{
if(GetPlayerState(i) == PLAYER_STATE_DRIVER)
{
if(GetVehicleSpeed(GetPlayerVehicleID(i)) > 5)
{
pKMs[i] += floatround(floatdiv(GetVehicleSpeed(vehicleid), 236.0));
format(string,sizeof(string),"~g~KMs: ~r~%d",pKMs[i]);
pInfo[i][pTotalDist] = pKMs[i];
}
}
}
return 1;
}
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
new file[200],
name[MAX_PLAYER_NAME];
format(file,sizeof(file),"LuxKnack/TeamStats/%s.ini",name);//Formating the var to the selected house directory.
INI_Open(file);//Opening the file with SII.
INI_WriteInt("KMDriven", pKMs[playerid]);
INI_Save();//Saving file with SII.
INI_Close();
in the directory there are 3 files created:
%s
'empty name'
and
'Playername' (wich is correct)
when I open that file it says kilometers driven: 0,
while I already drove 4 kms, and I checked it with a selfmade command to check the pKMs variable...
any help??