Advertisement
dodostyle

Mudar Nick e Mudar Senha

Nov 15th, 2012
909
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.61 KB | None | 0 0
  1. #define USODINI true //Deixe true Caso Você Use DINI
  2. #define USODOF2 false //Marque true Caso Você Use DOF2
  3. #include <a_samp>
  4. #if USODINI == true
  5. #include <dini>
  6. #endif
  7. #if USODOF2 == true
  8. #include <DOF2>
  9. #endif
  10.  
  11.  
  12. #define FILTERSCRIPT
  13.  
  14.  
  15. #define PASTADOJOGADORES "PastacaConta/%s.ini" //Mude a Pasta onde ta Os Jogadores
  16.  
  17. #define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
  18.  
  19. public OnFilterScriptInit()
  20. {
  21. print("Criado Por: DoDo - GTO Torcidas
  22. return 0x01;
  23. }
  24. public OnFilterScriptExit()
  25. {
  26. #if USODOF2 == true
  27. DOF2_Exit();
  28. #endif
  29. return 0x01;
  30. }
  31.  
  32. public OnPlayerCommandText(playerid, cmdtext[])
  33. {
  34. dcmd(mudarnick,9,cmdtext);
  35. dcmd(mudarsenha,10,cmdtext);
  36. return 0x01;
  37. }
  38. dcmd_mudarnick(playerid, params[])
  39. {
  40. if (!strlen(params)) return SendClientMessage(playerid, -1, "Uso Correto: /mudarmeunick <Novo Nick>");
  41. if (strlen(params) > 30) return SendClientMessage(playerid, -1, "Novo nick deve ser de 1 a 30 caracteres!");
  42. new stringa[80];
  43. format(stringa,sizeof(stringa),PASTADOJOGADORES,ReturnPlayer(playerid));
  44. if(fexist(stringa))
  45. {
  46. new stringa2[80];
  47. format(stringa2,sizeof(stringa2),PASTADOJOGADORES,strlen(params));
  48. if(fexist(stringa2)) return SendClientMessage(playerid, -1, "Esse Nick ja esta registrado no servidor!");
  49. frename(stringa,stringa2);
  50. SetPlayerName(playerid, params);
  51. return 0x01;
  52. }
  53. return 0x01;
  54. }
  55. dcmd_mudarsenha(playerid, params[])
  56. {
  57. if (!strlen(params)) return SendClientMessage(playerid, -1, "Uso Correto: /mudarsenha <Nova Senha>");
  58. if (strlen(params) > 100) return SendClientMessage(playerid, -1, "Nova senha deve ser de 1 a 100 caracteres!");
  59. new stringa[80];
  60. format(stringa,sizeof(stringa),PASTADOJOGADORES,ReturnPlayer(playerid));
  61. #if USODINI == true
  62. if(dini_Exists(stringa))
  63. {
  64. AtualizarDiniStr(playerid,"senha", params); //Criado Por DoDo - GTO Torcidas
  65. format(stringa,sizeof(stringa),"Você mudou sua senha para: %s",strlen(params));
  66. SendClientMessage(playerid, -1, stringa);
  67. return 0x01;
  68. }
  69. #endif
  70. #if USODOF2 == true
  71. if(DOF2_FileExists(stringa))
  72. {
  73. AtualizarDof2Str(playerid,"senha", params); //Criado Por DoDo - GTO Torcidas
  74. format(stringa,sizeof(stringa),"Você mudou sua senha para: %s",strlen(params));
  75. SendClientMessage(playerid, -1, stringa);
  76. return 0x01;
  77. }
  78. #endif
  79. return 0x01;
  80. }
  81.  
  82. stock ReturnPlayer(playerid)
  83. {
  84. new name[MAX_PLAYER_NAME];
  85. GetPlayerName(playerid,name,MAX_PLAYER_NAME);
  86. return name;
  87. }
  88. stock frename(oldname[],newname[])
  89. {
  90. if(fexist(oldname) && !fexist(newname))
  91. {
  92. new File: oldfile, File: newfile, str[0x800];
  93. oldfile = fopen(oldname, io_read);
  94. newfile = fopen(newname, io_write);
  95. fread(oldfile, str);
  96. fclose(oldfile);
  97. fremove(oldname);
  98. fwrite(newfile, str);
  99. fclose(newfile);
  100. return 1;
  101. }
  102. return 0;
  103. }
  104. #if USODINI == true
  105. AtualizarDiniStr(idpvt,local[], quant[])
  106. {
  107. new stringa[80];
  108. format(stringa,sizeof(stringa),PASTADOJOGADORES,ReturnPlayer(idpvt));
  109. dini_Set(stringa, local, quant);
  110. return 0x01;
  111. }
  112. #endif
  113. #if USODOF2 == true
  114. AtualizarDof2Str(idpvt,local[], quant[])
  115. {
  116. new stringa[80];
  117. format(stringa,sizeof(stringa),PASTADOJOGADORES,ReturnPlayer(idpvt));
  118. DOF2_SetString(stringa, local, quant);
  119. DOF2_SaveFile();
  120. return 0x01;
  121. }
  122. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement