Advertisement
MrAlienBG

Reputation save

May 28th, 2014
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 0.89 KB | None | 0 0
  1. #include <a_samp>
  2. #include <YSI\y_ini>
  3.  
  4. #define SaveDest "Reputation/%s.ini"
  5.  
  6. enum PlayerInfo
  7. {
  8.     Reputation,
  9. }
  10. new pInfo[MAX_PLAYERS][PlayerInfo];
  11. forward LoadRep(playerid,name[],value[]);
  12.  
  13. public LoadRep(playerid,name[],value[])
  14. {
  15.     INI_Int("Reputation", pInfo[playerid][Reputation]);
  16.     return 1;
  17. }
  18.  
  19. public OnPlayerConnect(playerid)
  20. {
  21.     INI_ParseFile(UserPath(playerid),"LoadRep",.bExtra = true, .extra = playerid);
  22.     return 1;
  23. }
  24.  
  25. public OnPlayerDisconnect(playerid, reason)
  26. {
  27.     new INI:File = INI_Open(UserPath(playerid));
  28.     INI_SetTag(File,"data");
  29.     INI_WriteInt(File, "Reputation", pInfo[playerid][Reputation]);
  30.     INI_Close(File);
  31.     return 1;
  32. }
  33. stock UserPath(playerid)
  34. {
  35.     new string[128],playername[MAX_PLAYER_NAME];
  36.     GetPlayerName(playerid,playername,sizeof(playername));
  37.     format(string,sizeof(string),SaveDest,playername);
  38.     return string;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement