[AJUDA] LOGIN BOX
#1

Bom Dia, Boa Noite e Boa Tarde... Seguinte Pessoal Eu Colokei Um Sistema de Login BOX No meu Server Dai Quando Eu Entro Eu Logo De Boa Mais se eu For Digitar Algum Comando de Admin Dis Assim "Vc tem que Estar Logado Para Usar Esse CMD" Entгo Quer Dizer Que Tenho que Digitar /logar [senha] Para Poder Digitar os Cmd a Mesma Coisa com os Players Se eu tentar Dar Adm a Ele Dis Que o Player Precisa Ta Logado Para Poder Receber Level de Adm Vlw Pessoal Espero Que Vcs do FORUM-SAMP MIn Ajudem Vlwww
Obs Quem Ajudar Leva Reputation
Reply
#2

Posta o comando da mensagem de erro.
Reply
#3

Poste o seu sistema de login box.
Reply
#4

Aki estб:
Quote:

#include <a_samp>
#include <dini>
#define FILTERSCRIPT
#define DialogRegistro 696
#define DialogLogin 697
#define DialogSaidaA 698
#define DialogSaidaB 699
//MMMMMMMMMMMMM|| [BDP]Config ||MMMMMMMMMMMMMMM//
#define Players "/Players/%s.ini"//Caso altere lembre-se de contar os caracteres e alterar em ( new arquivo[]; )
#define VALOR_MAXIMO_VIDA 100//Caso o seu servidor contenha algum valor maximo de vida altere aqui para o determinado valor
#define VALOR_MAXIMO_COLETE 100//Caso o seu servidor contenha algum valor maximo de colete altere aqui para o determinado valor
#define ATIVAR_CASE_SENSITIVE false //false = ATIVADO || true = DESATIVADO
#define MAXIMO_TLOGAR 4//Quantidade de vezes que o player pode tentar logar ao errar a senha

new TentativasDeLogar[MAX_PLAYERS];
new TotalMorreu[MAX_PLAYERS];
new TotalMatou[MAX_PLAYERS];
new nome[MAX_PLAYER_NAME];
new arquivo[44];

stock SalvarDadosPlayer(playerid)
{
GetPlayerName(playerid, nome, sizeof(nome));
format(arquivo, sizeof(arquivo), Players, nome);
if(!dini_Exists(arquivo)) dini_Create(arquivo);

new Float:Vida, Float:Colete;
GetPlayerHealth(playerid, Vida);
GetPlayerArmour(playerid, Colete);
dini_IntSet(arquivo, "Dinheiro", GetPlayerMoney(playerid));
dini_IntSet(arquivo, "Level", GetPlayerScore(playerid));
dini_IntSet(arquivo, "LevelProcurado", GetPlayerWantedLevel(playerid));
dini_IntSet(arquivo, "SkinPlayer", GetPlayerSkin(playerid));
dini_FloatSet(arquivo, "Vida", Vida);
dini_FloatSet(arquivo, "Colete", Colete);
dini_IntSet(arquivo, "TotalMorreu", TotalMorreu[playerid]);
dini_IntSet(arquivo, "TotalMatou", TotalMatou[playerid]);
return 0x1;
}

stock CarregarDadosPlayer(playerid)
{
GetPlayerName(playerid, nome, sizeof(nome));
format(arquivo, sizeof(arquivo), Players, nome);
if(!dini_Exists(arquivo)) return 0x1;

GivePlayerMoney(playerid, dini_Int(arquivo, "Dinheiro"));
SetPlayerScore(playerid, dini_Int(arquivo, "Level"));
SetPlayerWantedLevel(playerid, dini_Int(arquivo, "LevelProcurado"));
SetPlayerSkin(playerid, dini_Int(arquivo, "SkinPlayer"));
SetPlayerHealth(playerid, dini_Float(arquivo, "Vida"));
SetPlayerArmour(playerid, dini_Float(arquivo, "Colete"));
TotalMorreu[playerid] = dini_Int(arquivo, "TotalMorreu");
TotalMatou[playerid] = dini_Int(arquivo, "TotalMatou");
return 0x1;
}

public OnFilterScriptInit()
{
print("MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM");
print("MM");
print("MM [BDP]Cristhian's Login Box");
print("MM");
print("MM (FilterScript Carregado)");
print("MM");
print("MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM");
return 1;
}

public OnFilterScriptExit()
{
print("MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM");
print("MM");
print("MM [BDP]Cristhian's Login Box");
print("MM");
print("MM (FilterScript Descarregado)");
print("MM");
print("MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM");
return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
new string[124];
GetPlayerName(playerid, nome, sizeof(nome));
format(arquivo, sizeof(arquivo), Players, nome);
if(!dini_Exists(arquivo))
{
format(string, sizeof(string), "Vocк ainda nгo possui registro em nosso servidor\n\nNome: %s\n\nInsira uma senha para registrar-se:", nome);
ShowPlayerDialog(playerid, DialogRegistro, DIALOG_STYLE_INPUT, "[BDP] - Registro", string, "Registrar", "Sair");
return 0x1;
}
if(dini_Exists(arquivo))
{
TentativasDeLogar[playerid] = 0;
format(string, sizeof(string), "Vocк jб possui registro em nosso servidor\n\nNome: %s\n\nInsira sua senha para logar-se:", nome);
ShowPlayerDialog(playerid, DialogLogin, DIALOG_STYLE_INPUT, "[BDP] - Login", string, "Logar", "Sair");
return 0x1;
}
return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
SalvarDadosPlayer(playerid);
return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
TotalMorreu[playerid] ++;
TotalMatou[killerid] ++;
return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp(cmdtext, "/salvardados", true))
{
SalvarDadosPlayer(playerid);
SendClientMessage(playerid, 0xFFFFFFAA, "Dados Salvos com sucesso !!");
return 0x1;
}
return 0;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
new string[124];
if(dialogid == DialogRegistro)
{
if(!response) ShowPlayerDialog(playerid, DialogSaidaA, DIALOG_STYLE_MSGBOX, "[BDP]Confirmar Saida", "Vocк ainda nгo estб registrado. Tem certeza que deseja sair ?", "Sair", "Voltar");
if(response)
{
if(strlen(inputtext) == 0)
{
SendClientMessage(playerid, 0xFF0000AA, "Senha invбlida...Insira uma senha para que possa registrar !!");
format(string, sizeof(string), "Vocк ainda nгo possui registro em nosso servidor\n\nNome: %s\n\nInsira uma senha para registrar-se:", nome);
return ShowPlayerDialog(playerid, DialogRegistro, DIALOG_STYLE_INPUT, "[BDP] - Registro", string, "Registrar", "Sair");
}
GetPlayerName(playerid, nome, sizeof(nome));
format(arquivo, sizeof(arquivo), Players, nome);
dini_Create(arquivo);
dini_Set(arquivo, "Senha", inputtext);
dini_IntSet(arquivo, "Dinheiro", 0);
dini_IntSet(arquivo, "Level", 0);
dini_IntSet(arquivo, "LevelProcurado", 0);
dini_IntSet(arquivo, "SkinPlayer", 0);
dini_FloatSet(arquivo, "Vida", VALOR_MAXIMO_VIDA);
dini_FloatSet(arquivo, "Colete", VALOR_MAXIMO_COLETE);
dini_IntSet(arquivo, "TotalMorreu", 0);
dini_IntSet(arquivo, "TotalMatou", 0);
SendClientMessage(playerid, 0xFFFFFFAA, "[BDR]Registro concluido com sucesso !!");
SpawnPlayer(playerid);
}
}
if(dialogid == DialogLogin)
{
if(!response) ShowPlayerDialog(playerid, DialogSaidaB, DIALOG_STYLE_MSGBOX, "[BDP]Confirmar Saida", "Vocк ainda nгo estб logado. Tem certeza que deseja sair ?", "Sair", "Voltar");
if(response)
{
if(strlen(inputtext) == 0)
{
SendClientMessage(playerid, 0xFF0000AA, "Senha invбlida...Insira uma senha para que possa logar !!");
format(string, sizeof(string), "Vocк jб possui registro em nosso servidor\n\nNome: %s\n\nInsira sua senha para logar-se:", nome);
return ShowPlayerDialog(playerid, DialogLogin, DIALOG_STYLE_INPUT, "[BDP] - Login", string, "Logar", "Sair");
}
GetPlayerName(playerid, nome, sizeof(nome));
format(arquivo, sizeof(arquivo), Players, nome);
if(!strcmp(inputtext, dini_Get(arquivo, "Senha"), ATIVAR_CASE_SENSITIVE))
{
SendClientMessage(playerid, 0xFFFFFFAA, "[BDP]Login efetuado com sucesso!!");
SpawnPlayer(playerid);
CarregarDadosPlayer(playerid);
}
else
{
TentativasDeLogar[playerid] ++;
if(TentativasDeLogar[playerid] < MAXIMO_TLOGAR)
{
SendClientMessage(playerid, 0xFF0000AA, "Senha INCORRETA !! Caso nгo acerte a senha vocк serб kickado por motivos de seguranзa !!");
format(string, sizeof(string), "Vocк jб possui registro em nosso servidor\n\nNome: %s\n\nInsira sua senha para logar-se:", nome);
ShowPlayerDialog(playerid, DialogLogin, DIALOG_STYLE_INPUT, "[BDP] - Login", string, "Logar", "Sair");
return 0x1;
}
if(TentativasDeLogar[playerid] >= MAXIMO_TLOGAR)
{
SendClientMessage(playerid, 0xFF0000AA, "Vocк nгo acertou a senha em um numero maximo de tentativas. Por isto foi kickado");
Kick(playerid);
return 0x1;
}
}
}
}
if(dialogid == DialogSaidaA)
{
if(response)
{
SendClientMessage(playerid, 0xFF0000AA, "Vocк decidiu sair do servidor sem se registrar !! Volte Sempre...");
Kick(playerid);
}
else
{
format(string, sizeof(string), "Vocк ainda nгo possui registro em nosso servidor\n\nNome: %s\n\nInsira uma senha para registrar-se:", nome);
ShowPlayerDialog(playerid, DialogRegistro, DIALOG_STYLE_INPUT, "[BDP] - Registro", string, "Registrar", "Sair");
}
}
if(dialogid == DialogSaidaB)
{
if(response)
{
SendClientMessage(playerid, 0xFF0000AA, "Vocк decidiu sair do servidor sem se logar !! Volte Sempre...");
Kick(playerid);
}
else
{
format(string, sizeof(string), "Vocк jб possui registro em nosso servidor\n\nNome: %s\n\nInsira sua senha para logar-se:", nome);
ShowPlayerDialog(playerid, DialogLogin, DIALOG_STYLE_INPUT, "[BDP] - Login", string, "Logar", "Sair");
}
}
return 1;
}

Reply
#5

cara usa [pawn*] oque ker fala [*/pawn]


sem os *
Reply
#6

pawn Код:
new bool:Logado[MAX_PLAYERS];  // No topo

public OnPlayerConnect(playerid)
{
    Logado[playerid] = false;//acrescente isso

    return 1;
}

stock CarregarDadosPlayer(playerid);
{
    Logado[playerid] = true;//acrescente isso
}

Depois disso, й sу colocar no comando.

Ex:

pawn Код:
if(strcmp(cmdtext, "comando", true) == 0)
{
    if(Logado[playerid] == false)
        return SendClientMessage(playerid,-1,"Vocк nгo estб logado.");

    return 1;
}
Reply
#7

Nгo Intendir Essa Parada de COmando AI... que й?
Reply
#8

Й sу um exemplo de como usar.

No caso, se o jogador nгo estiver logado, apareзe a mensagem.
Reply
#9

TENSO Deu 7 Erros:
Quote:

C:\Documents and Settings\*******\Desktop\SA-MP\SA-MP SERVER\BDP\gamemodes\BDP.pwn(1033) : error 021: symbol already defined: "CarregarDadosPlayer"
C:\Documents and Settings\*******\Desktop\SA-MP\SA-MP SERVER\BDP\gamemodes\BDP.pwn(1040) : error 021: symbol already defined: "TextDrawCreate"
C:\Documents and Settings\*******\Desktop\SA-MP\SA-MP SERVER\BDP\gamemodes\BDP.pwn(1043) : error 021: symbol already defined: "TextDrawCreate"
C:\Documents and Settings\*******\Desktop\SA-MP\SA-MP SERVER\BDP\gamemodes\BDP.pwn(1047) : error 021: symbol already defined: "GivePlayerMoney"
C:\Documents and Settings\*******\Desktop\SA-MP\SA-MP SERVER\BDP\gamemodes\BDP.pwn(1049) : error 021: symbol already defined: "GetPlayerName"
C:\Documents and Settings\*******\Desktop\SA-MP\SA-MP SERVER\BDP\gamemodes\BDP.pwn(1055) : error 021: symbol already defined: "SendClientMessage"
C:\Documents and Settings\*******\Desktop\SA-MP\SA-MP SERVER\BDP\gamemodes\BDP.pwn(1064) : error 010: invalid function or declaration

As Linha sгo Essas:
pawn Код:
stock CarregarDadosPlayer(playerid);
TextDrawCreate(-1.000000,432.000000," ~g~[BDP]~w~              ---->> http://WWW.SAMPKND.CO.CC <<----");
TextDrawCreate(-1.000000,418.000000,"            ~w~BRASIL DRIFT PAWNO");
GivePlayerMoney(playerid, 500000);
GetPlayerName(playerid, pName, 30);
SendClientMessage(playerid, 0xE6E6E6E6, "|================BDP===============|");
return 1;
Oque й? TENSO'
Reply
#10

Vocк copiou tudo que eu te mandei e colou no GM?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)