09.11.2013, 18:21
When I enter the server, even with registered account sometimes the dialog asks me to register, and sometimes to login. and even I registering / logging appears again even after logged in or registered, the dialog again. But if I have registered at the end will only login normally. And if I'm not registered, will register normally.
Only the fact is kinda messy time you see a, time appears another and appear two times. This started after I tried to do the mysql.
OnPlayerConnect
OnPlayerRequestClass
DialogReponse LOGIN
DialogResponse Register
Command Login
Command Register
OnPlayerLogin
OnPlayerRegister
It is only a matter of correction, and learning organization.
I know that was a bit long, plus the portion MySQL to analyze is small. wanted to put everything no questions or missing something.
I appreciate the patience of those who can help me.
Thank you.!
Only the fact is kinda messy time you see a, time appears another and appear two times. This started after I tried to do the mysql.
OnPlayerConnect
pawn Код:
new Str[74], Nome[21], ip[16];
GetPlayerIp(playerid, ip, sizeof ip);
GetPlayerName(playerid, Nome, 21);
format(Str, 74, "SELECT `Nome` FROM `contas` WHERE `Nome`='%s' LIMIT 0,1", Nome);
mysql_function_query(Connect, Str, true, "OnPlayerRequestClass", "i", playerid); // I think the mistake here can
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
if(IsPlayerNPC(playerid))
{
SpawnPlayer(playerid);
return 1;
}
new ip[16];
GetPlayerIp(playerid, ip, sizeof ip);
new Row, Field;
cache_get_data(Row, Field, Connect);
if (RegistrationStep[playerid] == 0 && gPlayerLogged[playerid] != 1)
{
PlayerPlaySound(playerid, 1183, 0.0, 0.0, 0.0);
ClearChatbox(playerid, 10);
GameTextForPlayer(playerid," ~n~ ~n~ ~n~ ~n~ ~n~ ~n~ ~n~ ~g~Brasil ~y~Vision ~b~Street ~n~~r~RPG ~w~v.1.0",10000,6);
//SetPlayerInterior(playerid,14);
SetPlayerFacingAngle(playerid, 270.0);
SetPlayerCameraPos(playerid,1417.5546,-1581.0309,95.5510);
SetPlayerCameraLookAt(playerid,1512.7004,-1711.9816,17.7686);
//SetPlayerInterior(playerid,1);
SetPlayerInterior(playerid,0);
if(Row)
{
new loginstring[256];
new loginname[64];
GetPlayerName(playerid,loginname,sizeof(loginname));
SendClientMessage(playerid, COLOR_AZULBB, "");
SendClientMessage(playerid, COLOR_AZULBB, "");
SendClientMessage(playerid, COLOR_AZULBB, "");
SendClientMessage(playerid, COLOR_AZULBB, "");
SendClientMessage(playerid, COLOR_AZULBB, "");
SendClientMessage(playerid, COLOR_AZULBB, "");
SendClientMessage(playerid, COLOR_AZULBB, "");
SendClientMessage(playerid, COLOR_AZULBB, "");
SendClientMessage(playerid, COLOR_AZULBB, "");
SendClientMessage(playerid, COLOR_AZULBB, "");
SendClientMessage(playerid, COLOR_AZULBB, "");
SendClientMessage(playerid, COLOR_AZULBB, "");
SendClientMessage(playerid, COLOR_AZULBB, "");
SendClientMessage(playerid, COLOR_AZULBB, "");
SendClientMessage(playerid, COLOR_AZULBB, "");
SendClientMessage(playerid, COLOR_AZULBB, ".•.•.•.•.•.•Seu nick estб registrado, faзa login abaixo.•.•.•.•.•.•");
SendClientMessage(playerid, COLOR_AZULBB, ".•.•.•.•.•.•Caso erre a senha 5 vezes, terб o ip banido.•.•.•.•.•.•");
format(loginstring,sizeof(loginstring),"{33CCFF}******************************************\n\n{f2fafa}Bem vindo(a), {12e03b}%s\n\n{f2fafa}Digite sua senha para entrar no servidor!!!\n\n{33CCFF}******************************************",loginname);
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_PASSWORD,"{00FF00}Brasil {f3f300}Vision {898989}Street {2641FE}[RPG v1.0]",loginstring,"Logar","Sair");
}
else
{
new loginstring[256];
new loginname[64];
GetPlayerName(playerid,loginname,sizeof(loginname));
format(loginstring,sizeof(loginstring),"{33CCFF}******************************************\n\n{f2fafa}Bem vindo(a), {12e03b}%s\n\n{f2fafa}Digite sua senha para se registrar!!!\n\n{33CCFF}******************************************",loginname);
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT,"{00FF00}Brasil {f3f300}Vision {898989}Street {2641FE}[RPG v1.0]",loginstring,"Registrar","Sair");
SendClientMessage(playerid, COLOR_AZULBB, "Vocк nгo estб registrado! Se Registre Para Jogar");
SendClientMessage(playerid, COLOR_AZULBB, "Para ter acesso ao servidor vocк precisa se registrar.");
}
PlayerInfo[playerid][pSkin] = Peds[classid][0];
SetPlayerTeamFromClass(playerid,classid);
}
else { SpawnPlayer(playerid); }
return false;
}
pawn Код:
if(dialogid == 1)
{
if(response == 0)
{
SendClientMessage(playerid, TEAM_VAGOS_COLOR, "Ok, Caso queira fazer login posteriormente use /logar [senha]!");
return 1;
}
if(response >= 1)
{
if(strlen(inputtext) == 0)
{
new loginstring[256];
new loginname[64];
GetPlayerName(playerid,loginname,sizeof(loginname));
SendClientMessage(playerid, COLOR_AZULBB, "");
SendClientMessage(playerid, COLOR_AZULBB, ".•.•.•.•.•.•Caso erre a senha 5 vezes, terб o ip banido.•.•.•.•.•.•");
format(loginstring,sizeof(loginstring),"{33CCFF}******************************************\n\n{f2fafa}Bem vindo(a), {12e03b}%s\n\n{f2fafa}Digite sua senha para entrar no servidor!!!\n\n{33CCFF}******************************************",loginname);
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_PASSWORD,"{00FF00}Brasil {f3f300}Vision {898989}Street {2641FE}[RPG v1.0]",loginstring,"Logar","Sair");
PlayerPlaySound(playerid, 1098, 0.0, 0.0, 0.0);
return 1;
}
format(gstring,sizeof(gstring),"/logar %s",inputtext);
OnPlayerCommandText(playerid,gstring);
return 1;
}
return 1;
}
pawn Код:
if(dialogid == 2)
{
if(response == 0)
{
SendClientMessage(playerid, TEAM_VAGOS_COLOR, "Ok, Caso queira se registrar posteriormente use /registrar [senha]!");
return 1;
}
if(response >= 1)
{
if(strlen(inputtext) == 0)
{
SetPlayerInterior(playerid,0);
SetPlayerCameraPos(playerid,1417.5546,-1581.0309,95.5510);
SetPlayerCameraLookAt(playerid,1512.7004,-1711.9816,17.7686);
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_PASSWORD, "Brasil Vision Street", "Bem Vindo ao Brasil Vision Street\nDigite sua senha para se registrar!", "Registrar", "Esperar");
return 1;
}
format(gstring,sizeof(gstring),"/registrar %s",inputtext);
OnPlayerCommandText(playerid,gstring);
return 1;
}
return 1;
}
pawn Код:
if (strcmp(cmd, "/logar", true) ==0 )
{
if(IsPlayerConnected(playerid) && !IsPlayerNPC(playerid))
{
new tmppass[64];
if(gPlayerLogged[playerid] == 1)
{
SendClientMessage(playerid, COLOR_GREY, " Vocк jб estб logado.");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD1, "USE: /logar [Senha]");
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_PASSWORD, "{00FF00}Brasil {f3f300}Vision {898989}Street {2641FE}[RPG v1.0]", "Bem Vindo ao Brasil Vision Street\nDigite sua senha para entrar no servidor!!!", "Logar", "Esperar");
return 1;
}
strmid(tmppass, tmp, 0, strlen(cmdtext), 255);
//OnPlayerLogin(playerid,tmppass);
new Str[109], Nome[21];
GetPlayerName(playerid, Nome, 21);
format(Str, 109, "SELECT `Nome`, `Key` FROM `contas` WHERE `Nome`='%s' AND `Key`='%s'", Nome, tmppass);
mysql_function_query(Connect, Str, true, "OnPlayerLogin", "ii", playerid);
}
return 1;
}
pawn Код:
if (strcmp(cmd, "/registrar", true) ==0 )
{
if(IsPlayerConnected(playerid))
{
if(gPlayerLogged[playerid] == 1)
{
SendClientMessage(playerid, COLOR_GREY, " Vocк jб estб logado.");
return 1;
}
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, 64, "Players/%s.ini", sendername);
/*if (hFile)
{
SendClientMessage(playerid, COLOR_YELLOW, "{FF0000}{FFFFFF}[{00FF00}B{f3f300}V{909090}S{FFFFFF}]{CCCCFF} : Este Nick jб existe, use outro por favor.");
fclose(hFile);
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Brasil Vision Street - Registro", "Bem Vindo ao Brasil Vision Street\nDigite sua senha para se registrar!!!", "Registrar", "Cancelar");
return 1;
}*/
new tmppass[64];
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD1, "USE: /registrar [Senha]");
SendClientMessage(playerid, COLOR_YELLOW, "-==> Use Nome_Sobrenome ( Ex: Kleversson_Ribeiro ) <==-");
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Brasil Vision Street - Registro", "Bem Vindo ao Brasil Vision Street\nDigite sua senha para se registrar!!!", "Registrar", "Cancelar");
return 1;
}
strmid(tmppass, tmp, 0, strlen(cmdtext), 255);
new Str[65], Nome[21];
GetPlayerName(playerid, Nome, 21);
format(Str, 65, "SELECT `Nome` FROM `contas` WHERE `Nome`='%s'", Nome);
mysql_function_query(Connect, Str, true, "OnPlayerRegister", "is", playerid,tmppass);
//OnPlayerRegister(playerid,tmppass);
}
return 1;
}
pawn Код:
new Row, Field;
cache_get_data(Row, Field, Connect);
if(Row)
{
new Str[1123], Nome[21];
GetPlayerName(playerid, Nome, 21);
format(Str, 98, "SELECT `Level`, `AdminLevel`, `Helper`, `DonateRank`, `PontosVIP`, `Voto`, `Familia`, `LFamilia`, ");
format(Str, 233, "%s `Caixinha`, `UpgradePoints`, `ConnectedTime`, `Registered`, `Sex`, `Respect`, `Dinamit`, `Money`, `Bank`, `Barras`, `Crimes`, `Kills`,", Str);
format(Str, 350, "%s `Deaths`, `Phonebook`, `LottoNr`, `Fishes`, `BiggestFish`, `Emprego`, `Paycheck`, `HeadValue`, `Jailed`, `JailTime`,", Str);
format(Str, 469, "%s `Materiais`, `Maconha`, `Cocaina`, `Crack`, `Lider`, `Member`, `Rank`, `Char`, `ContractTime`, `DetSkill`, `SexSkill`,", Str);
format(Str, 591, "%s `BoxSkill`, `LawSkill`, `MechSkill`, `NewsSkill`, `DrogasSkill`, `CookSkill`, `FishSkill`, `pSHealth`, `Team`, `PhoneNr`,", Str);
format(Str, 707, "%s `House`, `Bizz`, `Spawn`, `SafeMaconha`, `SafeCocaina`, `SafeCrack`, `NivelProcurado`, `Galao`, `Madeira`, `Pizza`,", Str);
format(Str, 825, "%s `SafeMateriais`, `Pos_x`, `Pos_y`, `Pos_z`, `CarLic`, `FlyLic`, `BoatLic`, `FishLic`, `GunLic`, `PayDay`, `CDPlayer`,", Str);
format(Str, 941, "%s `Wins`, `Loses`, `AlcoholPerk`, `DrugPerk`, `MiserPerk`, `PainPerk`, `TraderPerk`, `Tutorial`, `Avisos`, `Married`,", Str);
format(Str, 1019, "%s `MarriedTo`, `Luta`, `Dorgado`, `Dorgado2`, `Doenca`, `Creditos`, `LU`, `IP`,", Str);
format(Str, 1123, "%s `Kicks`, `Bans`, `CadeiasAdm`, `Veiculo`, `CarKey` FROM `contas` WHERE `Nome` = '%s'", Str, Nome);
//print(Str);
mysql_function_query(Connect, Str, true, "OnPlayerLooad", "i", playerid);
}
else
{
SendClientMessage(playerid, COLOR_YELLOW, "Senha errada! - Se errar a senha 5 vezes terб o IP Banido!");
new loginstring[256];
new loginname[64];
GetPlayerName(playerid,loginname,sizeof(loginname));
format(loginstring,sizeof(loginstring),"{33CCFF}******************************************\n\n{f2fafa}Bem vindo(a), {12e03b}%s\n\n{f2fafa}Digite sua senha para entrar no servidor!!!\n\n{33CCFF}******************************************",loginname);
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_PASSWORD,"Brasil Vision Street v1.3B",loginstring,"Logar","Sair");
gPlayerLogTries[playerid] += 1;
if(gPlayerLogTries[playerid] == 5)
{
new stri[64], tmp[20], tmp3[20], ip[16];
GetPlayerIp(playerid, ip, sizeof ip);
format(stri, sizeof(stri), "IPsBanidos/%s.ini",ip);
getdate(Ano, Mes, Dia);
format(tmp, 20, "%d/%d/%d", Dia, Mes, Ano);
gettime(Hora, Minuto, Segundo);
format(tmp3, 20, "%d:%d:%d", Hora, Minuto, Segundo);
new Str[297];
format(Str, 133, "INSERT INTO `banlist`(`IP`, `Nome`, `Nick`, `Admin`, `Motivo`, `TempoBan`, `DataBan`, `HoraBan`, `Pic1`, `Pic2`, `Pic3`, `Detalhes`)");
format(Str, 297, "%s VALUES ('%s','naonaonao','%s','Automatico','Errou a senha 5 vezes','9999','%s','%s','---','---','---','In-Game')", Str, ip, PlayerName(playerid), tmp, tmp3);
mysql_function_query(Connect, Str, false, "", "");
//print(Str);
SetTimer("kickarr", 500, 0);
/*format(stri, sizeof(stri), "IPsBanidos/%s.ini",ip);
dini_Create(stri);
dini_Set(stri,"Motivo","Errou a senha 5 vezes");
dini_Set(stri,"Admin","Automбtico");
dini_Set(stri,"Data",tmp);
dini_Set(stri,"Hora",tmp3);
dini_Set(stri,"Nick",PlayerName(playerid));*/
PlayerInfo[playerid][pKicks] += 1;
Kick(playerid);
}
return 0;
}
pawn Код:
new Rows, Fields;
cache_get_data(Rows, Fields, Connect);
strmid(PlayerInfo[playerid][pKey], password, 0, strlen(password), 255);
if(!Rows)
{
new Str[2145], Nome[21], IP[16], ano, mes, dia, Strw[10];
GetPlayerName(playerid,Nome,21);
GetPlayerIp(playerid,IP,16);
getdate(ano,mes,dia);
format(Strw, 10, "%02d/%02d/%d",dia,mes,ano);
format(Str, 414, "INSERT INTO `contas`(`Nome`, `Key`, `Level`, `AdminLevel`, `Helper`, `DonateRank`, `PontosVIP`, `Voto`, `Familia`, `LFamilia`, `Caixinha`, `UpgradePoints`, `ConnectedTime`, `Registered`, `Sex`, `Respect`, `Dinamit`, `Money`, `Bank`, `Barras`, `Crimes`, `Kills`, `Deaths`, `Phonebook`, `LottoNr`, `Fishes`, `BiggestFish`, `Emprego`, `Paycheck`, `HeadValue`, `Jailed`, `JailTime`, `Materiais`, `Maconha`, `Cocaina`,");
format(Str, 812, " %s `Crack`, `Lider`, `Member`, `Rank`, `Char`, `ContractTime`, `DetSkill`, `SexSkill`, `BoxSkill`, `LawSkill`, `MechSkill`, `NewsSkill`, `DrogasSkill`, `CookSkill`, `FishSkill`, `pSHealth`, `Team`, `PhoneNr`, `House`, `Bizz`, `Spawn`, `SafeMaconha`, `SafeCocaina`, `SafeCrack`, `NivelProcurado`, `Galao`, `Madeira`, `Pizza`, `SafeMateriais`, `Pos_x`, `Pos_y`, `Pos_z`, `CarLic`, `FlyLic`, `BoatLic`,", Str);
format(Str, 1254, " %s `FishLic`, `GunLic`, `PayDay`, `CDPlayer`, `Wins`, `Loses`, `AlcoholPerk`, `DrugPerk`, `MiserPerk`, `PainPerk`, `TraderPerk`, `Tutorial`, `Avisos`, `Married`, `MarriedTo`, `Luta`, `Dorgado`, `Dorgado2`, `Doenca`, `Creditos`, `LU`, `Gun1`, `Gun2`, `Gun3`, `Gun4`, `Gun5`, `Gun6`, `Gun7`, `Gun8`, `Gun9`, `Gun10`, `Gun11`, `Gun12`, `Ammo1`, `Ammo2`, `Ammo3`, `Ammo4`, `Ammo5`, `Ammo6`, `Ammo7`, `Ammo8`, `Ammo9`, `Ammo10`, `Ammo11`, `Ammo12`,", Str);
format(Str, 1389, " %s `IP`, `DataReg`, `Descricao1`, `Descricao2`, `Descricao3`, `Descricao4`, `Email`, `Kicks`, `Bans`, `CadeiasAdm`, `Veiculo`, `CarKey`)", Str);
format(Str, 1780, " %s VALUES ('%s','%s','2','0','0','0','0','0','0','0','0','0','0','%i','%i','0','0','10000', '15000','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','%f','0','%i','255','255','0','0','0','0','0','0','0','0','0','1684.9','-2244.5',", Str, Nome, password, PlayerInfo[playerid][pReg], PlayerInfo[playerid][pSex], PlayerInfo[playerid][pSHealth], PlayerInfo[playerid][pPnumber]);
format(Str, 2145, " %s '13.5','0','0','0','0','0','0','0','0','0','0','0','0','0','0','%i','0','0','%s','0','0','0','0','0','%s','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','%s','%s','Descricao1','Descricao2','Descricao3','Descricao4','Email','0','0','0','255','255')", Str, PlayerInfo[playerid][pTut], PlayerInfo[playerid][pMarriedTo],PlayerInfo[playerid][pLastLogin],IP,Strw);
//print(Str);
mysql_function_query(Connect, Str, false, "", "");
}
else
{
new loginstring[256];
new loginname[64];
GetPlayerName(playerid,loginname,sizeof(loginname));
SendClientMessage(playerid, COLOR_AZULBB, "");
SendClientMessage(playerid, COLOR_AZULBB, "");
SendClientMessage(playerid, COLOR_AZULBB, "");
SendClientMessage(playerid, COLOR_AZULBB, "");
SendClientMessage(playerid, COLOR_AZULBB, "");
SendClientMessage(playerid, COLOR_AZULBB, "");
SendClientMessage(playerid, COLOR_AZULBB, "");
SendClientMessage(playerid, COLOR_AZULBB, "");
SendClientMessage(playerid, COLOR_AZULBB, "");
SendClientMessage(playerid, COLOR_AZULBB, "");
SendClientMessage(playerid, COLOR_AZULBB, "");
SendClientMessage(playerid, COLOR_AZULBB, "");
SendClientMessage(playerid, COLOR_AZULBB, "");
SendClientMessage(playerid, COLOR_AZULBB, "");
SendClientMessage(playerid, COLOR_AZULBB, "");
SendClientMessage(playerid, COLOR_AZULBB, ".•.•.•.•.•.•Seu nick estб registrado, fala login abaixo.•.•.•.•.•.•");
SendClientMessage(playerid, COLOR_AZULBB, ".•.•.•.•.•.•Caso erre a senha 5 vezes, terб o ip banido.•.•.•.•.•.•");
format(loginstring,sizeof(loginstring),"{33CCFF}******************************************\n\n{f2fafa}Bem vindo(a), {12e03b}%s\n\n{f2fafa}Digite sua senha para entrar no servidor!!!\n\n{33CCFF}******************************************",loginname);
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_PASSWORD,"{00FF00}Brasil {f3f300}Vision {898989}Street {2641FE}[RPG v1.0]",loginstring,"Logar","Sair");
PlayerPlaySound(playerid, 1098, 0.0, 0.0, 0.0);
}
I know that was a bit long, plus the portion MySQL to analyze is small. wanted to put everything no questions or missing something.
I appreciate the patience of those who can help me.
Thank you.!