Advertisement
DraKiNs

[INC] Sistema de Helper (Save/Load)

Jun 30th, 2011
493
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.63 KB | None | 0 0
  1. //===================================================
  2. //
  3. //               Criado por DraKiNs
  4. //
  5. //===================================================
  6.  
  7.  
  8. new
  9.     giHelperData[MAX_PLAYERS][3];
  10.  
  11. RemovePlayerHelper(i)
  12. {
  13.     return SetPlayerHelper(i, 0, 0, 0);
  14. }
  15.  
  16.  
  17. GetPlayerHelper(i)
  18. {
  19.     static year, month, day;
  20.     getdate(year, month, day);
  21.  
  22.     return (0 < giHelperData[i][2] >= year && 0 < giHelperData[i][0] >= day && 0 < giHelperData[i][1] >= month);
  23. }
  24.  
  25.  
  26. SetPlayerHelper(i, day, month, year)
  27. {
  28.     return giHelperData[i][0] = day, giHelperData[i][1] = month, giHelperData[i][2] = year, true;
  29. }
  30.  
  31. public OnPlayerDisconnect(playerid, reason)
  32. {
  33.     static
  34.         szName[MAX_PLAYER_NAME + 5]
  35.     ;
  36.  
  37.     GetPlayerName(playerid, szName, MAX_PLAYER_NAME);
  38.     strcat(szName, ".help");
  39.    
  40.     if(!fexist(szName)) Fini_Create(szName);
  41.  
  42.     Fini_OpenFile(szName)
  43.     {
  44.         Fini_SetVal("Dia",      giHelperData[playerid][0]);
  45.         Fini_SetVal("Mes",      giHelperData[playerid][1]);
  46.         Fini_SetVal("Ano",      giHelperData[playerid][2]);
  47.     }
  48.     Fini_SaveFile(szName);
  49.     return Fini_CloseFile();   
  50. }
  51.  
  52. public OnPlayerConnect(playerid)
  53. {
  54.     static
  55.         szName[MAX_PLAYER_NAME + 5]
  56.     ;
  57.  
  58.     GetPlayerName(playerid, szName, MAX_PLAYER_NAME);
  59.     strcat(szName, ".help");
  60.    
  61.     if(!fexist(szName))
  62.     {
  63.         Fini_Create(szName);
  64.         giHelperData[playerid][0] = 0;
  65.         giHelperData[playerid][1] = 0;
  66.         giHelperData[playerid][2] = 0;
  67.     }
  68.  
  69.     Fini_OpenFile(szName)
  70.     {
  71.         giHelperData[playerid][0] = Fini_GetValue("Dia");
  72.         giHelperData[playerid][1] = Fini_GetValue("Mes");
  73.         giHelperData[playerid][2] = Fini_GetValue("Ano");
  74.     }
  75.     Fini_SaveFile(szName);
  76.     return Fini_CloseFile(), true
  77.  
  78. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement