Quote:
Originally Posted by Dwane
pawn Код:
#include <a_samp> #include <dini>
#define MyFile "Points/%s.ini" // Create a floder inside Scriptfiles called 'Points' enum pInfo { Score } new PlayerInfo[MAX_PLAYERS][pInfo];
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); } else { PlayerInfo[playerid][Score]= 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); if(dini_Exists(File)) { dini_IntSet(File, "Points", PlayerInfo[playerid][Score]); } return 1; }
To save them after closing the console, you have to use the same part from OnPlayerDisconnect to OnFilterScriptExit but with loop or foreach.
|
Thank you for your help, but it still doesn't save any file.