PHP код:
public OnPlayerRequestClass(playerid, classid)
{
new aname[MAX_PLAYER_NAME], file[155], string[155];
GetPlayerName(playerid, aname,sizeof(aname));
format(file, sizeof(file), "ZP/Contas/%s.txt", aname);
if(!DOF2_FileExists(file))
{
format(string, sizeof(string), "{FFFFFF}Bem - Vindo а ZonePerfect \n\nNick: {2E8B57}%s!\n\n{FFFFFF}Registre-se:", aname);
ShowPlayerDialog(playerid, REGISTRO, DIALOG_STYLE_INPUT, "Registro - ZonePerfect", string, "Registrar", "Sair");
Logado[playerid] = false;
return 1;
}
else
{
format(string, sizeof(string), "{FFFFFF}Bem - Vindo Novamente! \n\nNick: {2E8B57}%s\n\n{FFFFFF}Digite Sua Senha Para Logar:", aname);
ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_PASSWORD, "Login - ZonePerfect", string, "Logar", "Sair");
}
return 1;
}
PHP код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == REGISTRO)
{
static aname[MAX_PLAYER_NAME], file[155], string[155];
GetPlayerName(playerid, aname,sizeof(aname));
format(file, sizeof(file), "ZP/Contas/%s.txt", aname);
if(response)
{
if(!strlen(inputtext))
{
format(string, sizeof(string), "{FFFFFF}Bem - Vindo а ZonePerfect \n\nNick: {2E8B57}%s\n\n{FFFFFF} Registre-se:", aname);
ShowPlayerDialog(playerid, REGISTRO, DIALOG_STYLE_INPUT, "Registro", string, "Registrar", "Sair");
}
static StrIp[16], str[50];
GetPlayerIp(playerid, StrIp, 16);
DOF2_CreateFile(file);
DOF2_Setstring(file, "Senha", inputtext);
DOF2_SetInt(file, "Dinheiro", 50000);
DOF2_SetInt(file, "Score", 0);
DOF2_SetInt(file, "Skin", 0);
DOF2_Setstring(file, "IP", StrIp);
DOF2_SetInt(file, "SavePos", 1);
DOF2_SaveFile();
ContaNova[playerid] = true;
GivePlayerMoney(playerid, 50000);
ContaPlayer[playerid][Dinheiro] = DOF2_GetInt(file, "Dinheiro");
ContaPlayer[playerid][Score] = DOF2_GetInt(file, "Score");
format(str, sizeof(str), "ZP/ADM/%s.sav", aname);
ContaPlayer[playerid][Level] = DOF2_GetInt(str, "Level");
Msg(playerid, cortag, "{FF0000} - CONTA - {FFFFFF}Bem Vindo Vocк Foi Registrado e Logado Automaticamente!");
CarregarVariaveis(playerid);
return 1;
}
else
{
format(string, sizeof(string), "{FF0000} - REGISTRO -{FFFFFF} O Player {2E8B57}%s{FFFFFF} Foi Kickado [Sem Registro.]", aname);
MsgToAll(cortag, string);
ZPKick(playerid);
return 1;
}
}
if(dialogid == LOGIN)
{
static aname[MAX_PLAYER_NAME], file[155], string[155];
GetPlayerName(playerid, aname,sizeof(aname));
format(file, sizeof(file), "ZP/Contas/%s.txt", aname);
if(response)
{
if(!strlen(inputtext))
{
format(string, sizeof(string), "{FFFFFF}Bem - Vindo Novamente \n\nNick: {2E8B57}%s\n\n{FFFFFF}Digite Sua Senha Para Logar:", aname);
ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_PASSWORD, "Login", string, "Logar", "Sair");
}
else
{
if(strcmp(DOF2_Getstring(file, "Senha"),inputtext, false ) == 0 )
{
if(ErrouSenha[playerid] == 4)
{
format(string, sizeof(string), "{FF0000} - LOGIN - {FFFFFF}O Player {2E8B57}%s{FFFFFF} Foi Kickado [Motivo: Senha Errada]", aname);
MsgToAll(cortag, string);
ZPKick(playerid);
return 1;
}
ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_PASSWORD, "Senha Errada!", "{FFFFFF}A Senha Que Vocк Digitou Estб {2E8B57}Errada!\n\n{FFFFFF}Digite Sua Senha:", "Logar", "Sair");
ErrouSenha[playerid]++;
return 1;
}
else
{
static str[50], StrIp[16];
format(str, 50, "ZP/ADM/%s.sav", aname);
if(DOF2_FileExists(str))
{
if(DOF2_IsSet(str, "Level"))
{
format(string, sizeof(string), "{FF0000} - CONTA - {FFFFFF}Sua Conta Possui ADM Level {2E8B57}%d{FFFFFF}, Logue Como ADMIN {2E8B57} /LogarAdm [SENHA]", DOF2_GetInt(str, "Level"));
Msg(playerid, cortag, string);
}
}
ContaPlayer[playerid][Dinheiro] = DOF2_GetInt(file, "Dinheiro");
ContaPlayer[playerid][Score] = DOF2_GetInt(file, "Score");
GivePlayerMoney(playerid, ContaPlayer[playerid][Dinheiro]);
SetPlayerScore(playerid, ContaPlayer[playerid][Score]);
ContaPlayer[playerid][Skin] = DOF2_GetInt(file, "Skin");
GetPlayerIp(playerid, StrIp, 16);
DOF2_Setstring(file, "IP", StrIp);
DOF2_SaveFile();
ContaNova[playerid] = false;
CarregarVariaveis(playerid);
SpawnPlayer(playerid);
return 1;
}
}
}
else
{
format(string, sizeof(string), "{FF0000} - LOGIN -{FFFFFF} O Player {2E8B57}%s{FFFFFF} Foi Kickado [Motivo: Sem Login.]", aname);
MsgToAll(cortag, string);
ZPKick(playerid);
return 1;
}
}
return 1;
}