Advertisement
Parix

iParixReg

Sep 14th, 2014
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.94 KB | None | 0 0
  1. // In cima:
  2. #include <a_samp>
  3. #include <zcmd>
  4. #include <sscanf2>
  5. #include <YSI\y_ini>
  6.  
  7. #define PATH "/Utenti/%s.ini"
  8.  
  9. enum pInfo
  10. {
  11.     Pw,
  12.     Soldi,
  13.     Admin,
  14.     Uccisioni,
  15.     Morti
  16. }
  17. new PlayerInfo[MAX_PLAYERS][pInfo];
  18.  
  19.  
  20.  
  21. public OnPlayerConnect(playerid)
  22. {
  23.     if(fexist(UserPath(playerid)))
  24.     {
  25.     INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
  26.     format(string,sizeof string,"Bentornato {00FFFF}%s!{FFFFFF} Utilizza {FF0000}/login [PASSWORD]{FFFFFF} per loggare!",nome);
  27.     SendClientMessageToAll(-1,string);
  28.     }
  29.     else
  30.     {
  31.     SendClientMessage(playerid, -1,"Non risulti registrato! Usa {FF0000}/registrami [PASSWORD]{FFFFFF} per registrarti!");
  32.     }
  33.     return 1;
  34. }
  35.  
  36. forward LoadUser_data(playerid,name[],value[]);
  37. public LoadUser_data(playerid,name[],value[])
  38. {
  39.     INI_Int("Password",PlayerInfo[playerid][Pw]);
  40.     INI_Int("Soldi",PlayerInfo[playerid][Soldi]);
  41.     INI_Int("Admin",PlayerInfo[playerid][Admin]);
  42.     INI_Int("Uccisioni",PlayerInfo[playerid][Uccisioni]);
  43.     INI_Int("Morti",PlayerInfo[playerid][Morti]);
  44.     return 1;
  45. }
  46.  
  47. CMD:registrami(playerid, params[])
  48. {
  49.     new INI:File = INI_Open(UserPath(playerid));
  50.     INI_SetTag(File,"data");
  51.     INI_WriteInt(File,"Password",udb_hash(params));
  52.     INI_WriteInt(File,"Soldi",0);
  53.     INI_WriteInt(File,"Admin",0);
  54.         INI_WriteInt(File,"Uccisioni",0);
  55.         INI_WriteInt(File,"Morti",0);
  56.         INI_Close(File);
  57.         SendClientMessage(playerid, -1,"Reg");
  58.  
  59.     return 1;
  60. }
  61.  
  62. CMD:login(playerid, params[])
  63. {
  64.         if(udb_hash(params) == PlayerInfo[playerid][Pw])
  65.         {
  66.             INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
  67.             GivePlayerMoney(playerid, PlayerInfo[playerid][Soldi]);
  68.             SendClientMessage(playerid, -1, "Hai effettuato il login!");
  69.             Loggato[playerid] = 1;
  70.         }
  71.         else
  72.         {
  73.             SendClientMessage(playerid, rosso,"Hai sbagliato la password!");
  74.             Kick(playerid);
  75.         }
  76.         return 1;
  77. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement