Advertisement
Guest User

CODE ATUALIZADO by LucasF

a guest
Oct 9th, 2013
1,255
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 7.30 KB | None | 0 0
  1. #define FILTERSCRIPT//DEFINE FILTERSCRIPT
  2. //------------------------- { - INCLUDES - } -----------------------------------
  3. #include <a_samp>//SAMP TEAM
  4. #include <DOF2>//Double-O-Seven
  5. //------------------------------------------------------------------------------
  6. #if defined FILTERSCRIPT//VERIFICA SE ESTÁ DEFINIDO
  7. //------------------------- { - DEFINIÇÕES - } ---------------------------------
  8. #define     DialogRegistro      (1)// DEFINE DIALOG REGISTRO
  9. #define     DialogLogin         (2)// DEFINE DIALOG LOGIN
  10. //------------------------------------------------------------------------------
  11. //------------------------- { - VARIÁVEIS - } ----------------------------------
  12. enum pDados
  13. {
  14.     Admin
  15. }
  16. new PlayerDados[MAX_PLAYERS][pDados];
  17. new bool:Logado[MAX_PLAYERS char];
  18. new SenhaErrada[MAX_PLAYERS];
  19. new Str[210];
  20. //------------------------------------------------------------------------------
  21.  
  22. //------------------------- { - CALLBACKS - } ----------------------------------
  23. public OnFilterScriptInit()
  24. {
  25.     print("---------------------------------------------");
  26.     print("         SISTEMA DO LucasF SENDO CARREGADO...");
  27.     print("                  LucasFerreira ©");
  28.     print(" ");
  29.     if(fexist("/LucasF/")) print("A pasta LucasF foi encontrada!"), print("Sistema do LucasF carregado com sucesso!");
  30.     else print("A pasta LucasF não foi encontrada!"), SendRconCommand("exit");
  31.     print("---------------------------------------------");
  32.     return 1;
  33. }
  34.  
  35. public OnFilterScriptExit()
  36. {
  37.     DOF2_Exit();
  38.     return 1;
  39. }
  40.  
  41. public OnPlayerRequestClass(playerid, classid)
  42. {
  43.     SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
  44.     SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
  45.     SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
  46.  
  47.     TogglePlayerSpectating(playerid, true);
  48.     if(!DOF2_FileExists(PegarConta(playerid)))
  49.     {
  50.         format(Str, sizeof(Str), "{FAF0E6}Bem vindo ao NomedoSeuServer, %s.\nEndereço IP: %s.\nVocê pode registrar uma conta, digitando uma senha desejada aqui:\n", getName(playerid), getIp(playerid));
  51.         ShowPlayerDialog(playerid, DialogRegistro, DIALOG_STYLE_PASSWORD, "{F5F5F5}Registro", Str, "Registrar", "Sair");
  52.     }
  53.     else
  54.     {
  55.         format(Str, sizeof(Str), "{FAF0E6}Bem vindo ao NomedoSeuServer, %s.\nEndereço IP: %s.\nO nome que você está usando é cadastrado, por favor digite uma senha para acessar:\n", getName(playerid), getIp(playerid));
  56.         ShowPlayerDialog(playerid, DialogLogin, DIALOG_STYLE_PASSWORD, "{F5F5F5}Login", Str, "Logar", "Sair");
  57.     }
  58.     return 1;
  59. }
  60.  
  61. public OnPlayerConnect(playerid)
  62. {
  63.     PlayerDados[playerid][Admin] = 0;
  64.     Logado{playerid} = false;
  65.     return 1;
  66. }
  67.  
  68. public OnPlayerDisconnect(playerid, reason)
  69. {
  70.     if(Logado{playerid} == true) SalvarDados(playerid);
  71.     else printf("A conta do player %s não pode ser salva!", getName(playerid));
  72.     Logado{playerid} = false;
  73.     return 1;
  74. }
  75.  
  76. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  77. {
  78.     switch(dialogid)
  79.     {
  80.         case DialogRegistro:
  81.         {
  82.             if(!response) return Kick(playerid);
  83.             if(response)
  84.             {
  85.                 if(strlen(inputtext) < 5 || strlen(inputtext) > 20)
  86.                 {
  87.                     format(Str, sizeof(Str), "{FAF0E6}Bem vindo ao NomedoSeuServer, %s.\nEndereço IP: %s.\nVocê pode registrar uma conta, digitando uma senha desejada aqui:\nSua senha deve conter entre 5 e 20 Caracteres", getName(playerid), getIp(playerid));
  88.                     return ShowPlayerDialog(playerid, DialogRegistro, DIALOG_STYLE_PASSWORD, "{F5F5F5}Registro", Str, "Registrar", "Sair");
  89.                 }
  90.                 new InfoSenha[65];
  91.                 format(InfoSenha,sizeof(InfoSenha),"Conta registrada com sucesso! Sua senha é: %s",inputtext);
  92.                 SendClientMessage(playerid,-1,InfoSenha);
  93.                 DOF2_CreateFile(PegarConta(playerid));
  94.                 DOF2_SetString(PegarConta(playerid),"Senha",inputtext);
  95.                 DOF2_SaveFile();
  96.                 SetSpawnInfo(playerid, 0, 0, 1722.5123, -1912.7931, 13.5647, 269.15, 0, 0, 0, 0, 0, 0);
  97.                 SpawnPlayer(playerid);
  98.                 TogglePlayerSpectating(playerid, false);
  99.                 Logado{playerid} = true;
  100.                 SendClientMessage(playerid,-1,"Registrado e Logado com sucesso!");
  101.                 GivePlayerMoney(playerid,1000);
  102.                 SetPlayerScore(playerid,1);
  103.             }
  104.         }
  105.         case DialogLogin:
  106.         {
  107.             if(!response) return Kick(playerid);
  108.             if(response)
  109.             {
  110.                 if(!strlen(inputtext))
  111.                 {
  112.                     format(Str, sizeof(Str), "{FAF0E6}Bem vindo ao NomedoSeuServer, %s.\nEndereço IP: %s.\nO nome que você está usando é cadastrado, por favor digite uma senha para acessar:\n", getName(playerid), getIp(playerid));
  113.                     return ShowPlayerDialog(playerid, DialogLogin, DIALOG_STYLE_PASSWORD, "{F5F5F5}Login", Str, "Logar", "Sair");
  114.                 }
  115.                 if(!strcmp(DOF2_GetString(PegarConta(playerid),"Senha"), inputtext))
  116.                 {
  117.                     CarregarDados(playerid);
  118.                     SetSpawnInfo(playerid, 0, 0, 1722.5123, -1912.7931, 13.5647, 269.15, 0, 0, 0, 0, 0, 0);
  119.                     SpawnPlayer(playerid);
  120.                     TogglePlayerSpectating(playerid, false);
  121.                     Logado{playerid} = true;
  122.                     SendClientMessage(playerid,-1,"Logado com sucesso!");
  123.                 }
  124.                 else
  125.                 {
  126.                     if(SenhaErrada[playerid] == 1)
  127.                     {
  128.                         SendClientMessage(playerid,-1,"Você foi kickado por errar a senha 2 vezes!");
  129.                         Kick(playerid);
  130.                     }
  131.                     else if(SenhaErrada[playerid] < 1)
  132.                     {
  133.                         SenhaErrada[playerid] ++;
  134.                         format(Str, sizeof(Str), "{FAF0E6}Bem vindo ao NomedoSeuServer, %s.\nEndereço IP: %s.\nO nome que você está usando é cadastrado, por favor digite uma senha para acessar:\nSenha Incorreta", getName(playerid), getIp(playerid));
  135.                         ShowPlayerDialog(playerid, DialogLogin, DIALOG_STYLE_PASSWORD, "{F5F5F5}Login", Str, "Logar", "Sair");
  136.                     }
  137.                 }
  138.             }
  139.         }
  140.     }
  141.     return 1;
  142. }
  143. //------------------------------------------------------------------------------
  144. //------------------------- { - STOCKS - } -------------------------------------
  145. stock getIp(playerid)
  146. {
  147.     static Ip[20]; GetPlayerIp(playerid, Ip, sizeof(Ip)); return Ip;
  148. }
  149. stock getName(playerid)
  150. {
  151.     static Nome[MAX_PLAYER_NAME]; GetPlayerName(playerid, Nome, sizeof(Nome)); return Nome;
  152. }
  153. stock PegarConta(playerid)
  154. {
  155.     static Arquivo[33]; format(Arquivo, sizeof(Arquivo), "LucasF/%s.ini", getName(playerid)); return Arquivo;
  156. }
  157. stock SalvarDados(playerid)
  158. {
  159.     DOF2_SetInt(PegarConta(playerid), "Level", GetPlayerScore(playerid));
  160.     DOF2_SetInt(PegarConta(playerid), "Dinheiro", GetPlayerMoney(playerid));
  161.     DOF2_SetInt(PegarConta(playerid), "LevelProcurado", GetPlayerWantedLevel(playerid));
  162.     DOF2_SetInt(PegarConta(playerid), "SkinAtual", GetPlayerSkin(playerid));
  163.     DOF2_SetInt(PegarConta(playerid), "AdminLevel", PlayerDados[playerid][Admin]);
  164.     DOF2_SaveFile();
  165. }
  166. stock CarregarDados(playerid)
  167. {
  168.     if(DOF2_FileExists(PegarConta(playerid)))
  169.     {
  170.         SetPlayerScore(playerid, DOF2_GetInt(PegarConta(playerid), "Level"));
  171.         GivePlayerMoney(playerid, DOF2_GetInt(PegarConta(playerid), "Dinheiro"));
  172.         SetPlayerWantedLevel(playerid, DOF2_GetInt(PegarConta(playerid), "LevelProcurado"));
  173.         SetPlayerSkin(playerid, DOF2_GetInt(PegarConta(playerid), "SkinAtual"));
  174.         PlayerDados[playerid][Admin] = DOF2_GetInt(PegarConta(playerid), "AdminLevel");
  175.     }
  176. }
  177. //------------------------------------------------------------------------------
  178. #endif// TERMINA O SCRIPT
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement