Guest User

Untitled

a guest
Nov 3rd, 2011
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.77 KB | None | 0 0
  1. #include a_samp
  2. #include SII
  3. #if defined MAX_PLAYERS
  4. #undef MAX_PLAYERS
  5. #endif
  6. #define MAX_PLAYERS 45
  7. #define contas "%s.ini"
  8. #define login "Bem vindo ao servidor %s digite sua senha para logar-se."
  9. #define registro "Bem vindo ao servidor %s registre-se."
  10. enum pInfo
  11. {
  12. pGrana,
  13. pLevel,
  14. pProcu
  15. };
  16. new playerinfo[MAX_PLAYERS][pInfo];
  17. new
  18. file[50],
  19. nome[24],
  20. paramount[90]
  21. ;
  22. public OnPlayerConnect(playerid)
  23. {
  24. GetPlayerName(playerid,nome,24);
  25. format(file,50,contas,nome);
  26. if(fexist(file))
  27. {
  28. GetPlayerName(playerid,nome,24);
  29. format(paramount,90,login,nome);
  30. ShowPlayerDialog(playerid,9998,DIALOG_STYLE_INPUT,"Servidor",paramount,"entrar","sair");
  31. }
  32. else
  33. {
  34. GetPlayerName(playerid,nome,24);
  35. format(paramount,90,registro,nome);
  36. ShowPlayerDialog(playerid,9999,DIALOG_STYLE_INPUT,"Servidor",paramount,"registrar","sair");
  37. }
  38. return 1;
  39. }public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  40. {
  41. if(dialogid == 9999)
  42. {
  43. if(!response) return Kick(playerid);
  44. if(response)
  45. {
  46. GetPlayerName(playerid,nome,24);
  47. format(file,50,contas,nome);
  48. INI_Open(file);
  49. INI_WriteString("senha",inputtext);
  50. playerinfo[playerid][pLevel] = INI_WriteInt("level",5);
  51. playerinfo[playerid][pGrana] = INI_WriteInt("dinheiro",5000);
  52. playerinfo[playerid][pProcu] = INI_WriteInt("Procurado", 0);
  53. INI_Save();
  54. INI_Close();
  55. format(paramount,90,login,nome);
  56. new len = strlen(inputtext);
  57. if(len < 5 || len > 20) return ShowPlayerDialog(playerid,9999,DIALOG_STYLE_INPUT,"Servidor","Senha deve conter no minimo 5 caracteres.","Ok","kick");
  58. return ShowPlayerDialog(playerid,9998,DIALOG_STYLE_INPUT,"Servidor",login,"ok","fechar");
  59. }
  60. }
  61. if(dialogid == 9998)
  62. {
  63. if(!response) return Kick(playerid);
  64. if(response)
  65. {
  66. new senha[20];
  67. GetPlayerName(playerid,nome,24);
  68. format(senha,20,"%s",strval(inputtext));
  69. format(file,50,contas,nome);
  70. INI_Open(file);
  71. INI_ReadString(senha,"senha");
  72. INI_Close();
  73. if(strcmp(senha,inputtext,true) == 0)
  74. {
  75. if(!strlen(inputtext))
  76. {
  77. ShowPlayerDialog(playerid,9998,DIALOG_STYLE_INPUT,"Servidor","senha errada, digite a senha correta para logar-se.","ok","sair");
  78. return SendClientMessage(playerid,-1,"senha errada.");
  79. }
  80. GetPlayerName(playerid,nome,24);
  81. format(file,28,contas,nome);
  82. INI_Open(file);
  83. SetPlayerScore(playerid,INI_ReadInt("level"));
  84. GivePlayerMoney(playerid,INI_ReadInt("dinheiro"));
  85. SetPlayerWantedLevel(playerid, INI_ReadInt("Procurado"));
  86. INI_Close();
  87. }
  88. else
  89. {
  90. ShowPlayerDialog(playerid,9998,DIALOG_STYLE_INPUT,"Servidor","senha errada, insira a senha correta.","ok","sair");
  91. SendClientMessage(playerid,-1,"senha errada.");
  92. }
  93. }
  94. }
  95. return 1;
  96. }
  97.  
Advertisement
Add Comment
Please, Sign In to add comment