Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define FILTERSCRIPT//DEFINE FILTERSCRIPT
- //------------------------- { - INCLUDES - } -----------------------------------
- #include <a_samp>//SAMP TEAM
- #include <DOF2>//Double-O-Seven
- //------------------------------------------------------------------------------
- #if defined FILTERSCRIPT//VERIFICA SE ESTÁ DEFINIDO
- //------------------------- { - DEFINIÇÕES - } ---------------------------------
- #define DialogRegistro (1)// DEFINE DIALOG REGISTRO
- #define DialogLogin (2)// DEFINE DIALOG LOGIN
- //------------------------------------------------------------------------------
- //------------------------- { - VARIÁVEIS - } ----------------------------------
- enum pDados
- {
- Admin
- }
- new PlayerDados[MAX_PLAYERS][pDados];
- new bool:Logado[MAX_PLAYERS char];
- new SenhaErrada[MAX_PLAYERS];
- new Str[210];
- //------------------------------------------------------------------------------
- //------------------------- { - CALLBACKS - } ----------------------------------
- public OnFilterScriptInit()
- {
- print("---------------------------------------------");
- print(" SISTEMA DO LucasF SENDO CARREGADO...");
- print(" LucasFerreira ©");
- print(" ");
- if(fexist("/LucasF/")) print("A pasta LucasF foi encontrada!"), print("Sistema do LucasF carregado com sucesso!");
- else print("A pasta LucasF não foi encontrada!"), SendRconCommand("exit");
- print("---------------------------------------------");
- return 1;
- }
- public OnFilterScriptExit()
- {
- DOF2_Exit();
- return 1;
- }
- public OnPlayerRequestClass(playerid, classid)
- {
- SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
- SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
- SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
- TogglePlayerSpectating(playerid, true);
- if(!DOF2_FileExists(PegarConta(playerid)))
- {
- 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));
- ShowPlayerDialog(playerid, DialogRegistro, DIALOG_STYLE_PASSWORD, "{F5F5F5}Registro", Str, "Registrar", "Sair");
- }
- else
- {
- 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));
- ShowPlayerDialog(playerid, DialogLogin, DIALOG_STYLE_PASSWORD, "{F5F5F5}Login", Str, "Logar", "Sair");
- }
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- PlayerDados[playerid][Admin] = 0;
- Logado{playerid} = false;
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- if(Logado{playerid} == true) SalvarDados(playerid);
- else printf("A conta do player %s não pode ser salva!", getName(playerid));
- Logado{playerid} = false;
- return 1;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- switch(dialogid)
- {
- case DialogRegistro:
- {
- if(!response) return Kick(playerid);
- if(response)
- {
- if(strlen(inputtext) < 5 || strlen(inputtext) > 20)
- {
- 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));
- return ShowPlayerDialog(playerid, DialogRegistro, DIALOG_STYLE_PASSWORD, "{F5F5F5}Registro", Str, "Registrar", "Sair");
- }
- new InfoSenha[65];
- format(InfoSenha,sizeof(InfoSenha),"Conta registrada com sucesso! Sua senha é: %s",inputtext);
- SendClientMessage(playerid,-1,InfoSenha);
- DOF2_CreateFile(PegarConta(playerid));
- DOF2_SetString(PegarConta(playerid),"Senha",inputtext);
- DOF2_SaveFile();
- SetSpawnInfo(playerid, 0, 0, 1722.5123, -1912.7931, 13.5647, 269.15, 0, 0, 0, 0, 0, 0);
- SpawnPlayer(playerid);
- TogglePlayerSpectating(playerid, false);
- Logado{playerid} = true;
- SendClientMessage(playerid,-1,"Registrado e Logado com sucesso!");
- GivePlayerMoney(playerid,1000);
- SetPlayerScore(playerid,1);
- }
- }
- case DialogLogin:
- {
- if(!response) return Kick(playerid);
- if(response)
- {
- if(!strlen(inputtext))
- {
- 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));
- return ShowPlayerDialog(playerid, DialogLogin, DIALOG_STYLE_PASSWORD, "{F5F5F5}Login", Str, "Logar", "Sair");
- }
- if(!strcmp(DOF2_GetString(PegarConta(playerid),"Senha"), inputtext))
- {
- CarregarDados(playerid);
- SetSpawnInfo(playerid, 0, 0, 1722.5123, -1912.7931, 13.5647, 269.15, 0, 0, 0, 0, 0, 0);
- SpawnPlayer(playerid);
- TogglePlayerSpectating(playerid, false);
- Logado{playerid} = true;
- SendClientMessage(playerid,-1,"Logado com sucesso!");
- }
- else
- {
- if(SenhaErrada[playerid] == 1)
- {
- SendClientMessage(playerid,-1,"Você foi kickado por errar a senha 2 vezes!");
- Kick(playerid);
- }
- else if(SenhaErrada[playerid] < 1)
- {
- SenhaErrada[playerid] ++;
- 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));
- ShowPlayerDialog(playerid, DialogLogin, DIALOG_STYLE_PASSWORD, "{F5F5F5}Login", Str, "Logar", "Sair");
- }
- }
- }
- }
- }
- return 1;
- }
- //------------------------------------------------------------------------------
- //------------------------- { - STOCKS - } -------------------------------------
- stock getIp(playerid)
- {
- static Ip[20]; GetPlayerIp(playerid, Ip, sizeof(Ip)); return Ip;
- }
- stock getName(playerid)
- {
- static Nome[MAX_PLAYER_NAME]; GetPlayerName(playerid, Nome, sizeof(Nome)); return Nome;
- }
- stock PegarConta(playerid)
- {
- static Arquivo[33]; format(Arquivo, sizeof(Arquivo), "LucasF/%s.ini", getName(playerid)); return Arquivo;
- }
- stock SalvarDados(playerid)
- {
- DOF2_SetInt(PegarConta(playerid), "Level", GetPlayerScore(playerid));
- DOF2_SetInt(PegarConta(playerid), "Dinheiro", GetPlayerMoney(playerid));
- DOF2_SetInt(PegarConta(playerid), "LevelProcurado", GetPlayerWantedLevel(playerid));
- DOF2_SetInt(PegarConta(playerid), "SkinAtual", GetPlayerSkin(playerid));
- DOF2_SetInt(PegarConta(playerid), "AdminLevel", PlayerDados[playerid][Admin]);
- DOF2_SaveFile();
- }
- stock CarregarDados(playerid)
- {
- if(DOF2_FileExists(PegarConta(playerid)))
- {
- SetPlayerScore(playerid, DOF2_GetInt(PegarConta(playerid), "Level"));
- GivePlayerMoney(playerid, DOF2_GetInt(PegarConta(playerid), "Dinheiro"));
- SetPlayerWantedLevel(playerid, DOF2_GetInt(PegarConta(playerid), "LevelProcurado"));
- SetPlayerSkin(playerid, DOF2_GetInt(PegarConta(playerid), "SkinAtual"));
- PlayerDados[playerid][Admin] = DOF2_GetInt(PegarConta(playerid), "AdminLevel");
- }
- }
- //------------------------------------------------------------------------------
- #endif// TERMINA O SCRIPT
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement