Advertisement
TecnoSamp

[FS] - Sistema de Registro

Apr 16th, 2012
3,372
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.05 KB | None | 0 0
  1. #include <a_samp>
  2. #include <dini>
  3.  
  4. #define DIALOG_REGISTRO 1
  5. #define DIALOG_LOGIN 2
  6. #define CONTAS "Contas/%s.ini"
  7.  
  8. #define TXT_RLOGIN "{FFFFFF}Nick: %s Registrado\n\n Digite Sua Senha Para Logar"
  9. #define TXT_LOGIN "{FFFFFF}Olá Você Esta Registrado\nStatus Da Conta\nNick: %s Registrado\n\n Digite Sua Senha Para Logar"
  10. #define TXT_NREGISTER "{FFFFFF}Olá, Você Não Esta Registrado\nStatus Da Conta\nNick: %s \nDigite Uma Senha Para Continuar"
  11. #define TXT_RL "Pronto você esta registrado \nAgora digite Sua Senha Para Logar-Se"
  12.  
  13. new TotalMatou[MAX_PLAYERS];
  14. new TotalMorreu[MAX_PLAYERS];
  15. new TotalLogou[MAX_PLAYERS];
  16.  
  17. forward SalvarLevel(playerid);
  18. forward CarregarLevel(playerid);
  19.  
  20. public OnFilterScriptInit()
  21. {
  22. print("\n\n__________________________________________________________________");
  23. print(" Sistema de registro MTO loaded!");
  24. print(" By : mau_tito");
  25. print(" ---------------------------");
  26. return 1;
  27. }
  28.  
  29. public OnFilterScriptExit()
  30. {
  31. print("\n\n__________________________________________________________________");
  32. print(" Sistema de registro MTO loaded!");
  33. print(" By : mau_tito");
  34. print(" ---------------------------");
  35. return 1;
  36. }
  37. SalvarPlayer(playerid)
  38. {
  39. new Nome[MAX_PLAYER_NAME];
  40. GetPlayerName(playerid, Nome, sizeof(Nome));
  41. new String[50];
  42. format(String, sizeof(String), CONTAS, Nome);
  43. dini_IntSet(String,"Dinheiro", GetPlayerMoney(playerid));
  44. dini_IntSet(String,"Total Matou", TotalMatou[playerid]);
  45. dini_IntSet(String,"Total Morreu", TotalMorreu[playerid]);
  46. dini_IntSet(String,"Total Logou", TotalLogou[playerid]);
  47. return 1;
  48. }
  49.  
  50. CarregarPlayer(playerid)
  51. {
  52. new Nome[MAX_PLAYER_NAME];
  53. GetPlayerName(playerid, Nome, sizeof(Nome));
  54. new String[50];
  55. format(String, sizeof(String), CONTAS, Nome);
  56. GivePlayerMoney(playerid, dini_Int(String,"Dinheiro"));
  57. TotalMatou[playerid] = dini_Int(String, "Total Matou");
  58. TotalMorreu[playerid] = dini_Int(String, "Total Morreu");
  59. TotalLogou[playerid] = dini_Int(String, "Total Logou");
  60. return 1;
  61. }
  62.  
  63. public OnGameModeExit()
  64. {
  65. for(new i=0; i<MAX_PLAYERS; i++)
  66. SalvarPlayer(i);
  67. return 1;
  68. }
  69.  
  70. public OnPlayerConnect(playerid)
  71. {
  72. new Nome[MAX_PLAYER_NAME];
  73. GetPlayerName(playerid, Nome, sizeof(Nome));
  74. new String[100];
  75. format(String, sizeof(String), CONTAS, Nome);
  76. if(!dini_Exists(String))
  77. {
  78. format(String, sizeof(String), TXT_NREGISTER, Nome);
  79. ShowPlayerDialog(playerid, DIALOG_REGISTRO, 3, "Registro", String, "Registrar", "Cancelar");
  80. }
  81. else
  82. {
  83. format(String, sizeof(String),TXT_LOGIN, Nome);
  84. ShowPlayerDialog(playerid, DIALOG_LOGIN, 3, "Registro Com Sucesso", String, "Logar", "Cancelar");
  85. }
  86. return 1;
  87. }
  88.  
  89. public OnPlayerDisconnect(playerid, reason)
  90. {
  91. SalvarPlayer(playerid);
  92. return 1;
  93. }
  94.  
  95. public OnPlayerDeath(playerid, killerid, reason)
  96. {
  97. if(IsPlayerConnected(killerid))
  98. {
  99. TotalMatou[killerid]++;
  100. }
  101. TotalMorreu[playerid]++;
  102. return 1;
  103. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement