03.05.2012, 15:07
Can you remove the mysql and to make a simply. I would be very grateful, I will give +rep 

Код:
if(dialogid == 201)
{/*
new vardas[MAX_PLAYER_NAME], string[128];
GetPlayerName(playerid, vardas, sizeof(vardas));
if(response)
{
if(!strlen(inputtext)) return ShowPlayerDialog(playerid,201,DIALOG_STYLE_INPUT,"{A3E4FF}Registracija","{FFFFFF}Jus neivedete slaptazodzio.\n{FFFFFF}Prasome ivesti slaptazodi, kad galetumete uzsiregistruoti.","Registruotis","Atsaukti");
if(strlen(inputtext) < 3 || strlen(inputtext) >= 32)
return ShowPlayerDialog(playerid,201,DIALOG_STYLE_INPUT,"{A3E4FF}Registracija","{FFFFFF}Slaptazodis yra per ilgas arba per trumpas.\n{FFFFFF}Prasome ivesti slaptazodi, kad galetumete uzsiregistruoti.","Registruotis","Atsaukti");
CheckMySQL();
format(string, sizeof(string), "INSERT INTO Saskaitos (Vardas,Slaptazodis) VALUES ('%s','%s')", vardas, (inputtext));
mysql_query(string);
SendClientMessage(playerid, geltona, "[FunZoneLT]>> Jusu vartotojas uzregistruotas, ir jus buvote automatiskai prijungtas.");
SendClientMessage(playerid, geltona, "[FunZoneLT]>> Sekmes zaidime jums linki Administracijos komanda!");
}*/
if(response)
{
if(!strlen(inputtext) || strlen(inputtext) > 100) //Password is not 1 to 100 characters
{
ShowPlayerDialog(playerid,201,DIALOG_STYLE_INPUT,"{A3E4FF}Registracija","{FFFFFF}Jus neivedete slaptazodzio.\n{FFFFFF}Prasome ivesti slaptazodi, kad galetumete uzsiregistruoti.","Registruotis","Atsaukti");
}
else if(strlen(inputtext) > 0 && strlen(inputtext) < 100)
{
new escpass[100];
mysql_real_escape_string(inputtext, escpass);
MySQL_Register(playerid, escpass);
}
}
else
{
SendClientMessage(playerid, raudona, "[FunZoneLT]>> Jus turite uzsiregistruoti serveryje, pries zaidziant!");
Kick(playerid);
}
}
if(dialogid == 200)
{
if(response) //If the player clicked login
{
new query[200], pname[24], escapepass[100]; //
GetPlayerName(playerid, pname, 24); //Gets the players name
mysql_real_escape_string(inputtext, escapepass); //We escape the inputtext to avoid SQL injections.
format(query, sizeof(query), "SELECT `Vardas` FROM Saskaitos WHERE Vardas = '%s' AND Slaptazodis = SHA1('%s')", pname, escapepass);
mysql_query(query);
mysql_store_result();
new numrows = mysql_num_rows();
if(numrows == 1) MySQL_Login(playerid);
//This means that there is a user in the database with the same
//password that we typed, we now proceed by using the login function.
if(!numrows)
{
//This means that the password that the player
//typed was incorrect and we will resend the dialog.
ShowPlayerDialog(playerid,200,DIALOG_STYLE_INPUT,"{A3E4FF}Prisijungimas","{FFFFFF}Jus ivedete neteisinga slaptazodi.\n{FFFFFF}Prasome ivesti teisinga slaptazodi, kad galetumete prisijungti!","Prisijungti","Atsaukti");
}
mysql_free_result(); //Remember to always free a result if you stored one!
}
else
{
SendClientMessage(playerid, raudona, "[FunZoneLT]>> Jus turite prisijungti prie serverio, pries zaidziant!");
Kick(playerid);
}
Код:
}
if(dialogid == 0) //Jei dialogid bus lygus 0
{
new string[120], vardas[MAX_PLAYER_NAME];
GetPlayerName(playerid, vardas, sizeof(vardas));
if(response)
{
MoneyGiven[playerid] = -1; //Resets the variable that you will discover later in the tutorial.
new query[200], pname[24]; //Creates our variables.
GetPlayerName(playerid, pname, 24); //Gets the players name
format(query, sizeof(query), "SELECT IP FROM `Saskaitos` WHERE Vardas = '%s' LIMIT 1", pname); //Formats the query, view above the code for a explanation
mysql_query(query); //This is our query function to query the string
mysql_store_result(); //We store the result.
SendClientMessage(playerid, raudona, "[FunZoneLT]>> NEVEIKIA!!!");
new rows = mysql_num_rows(); //We get how many rows the query returned.
if(!rows)
{
//If the rows are equal to 0. This means that the query did not find
//anyone under the name we connected under in the database.
//So here we send the player the register dialog.
format(string, sizeof(string), "{FFFFFF}Zaidejo {FFAF00}%s {FFFFFF}registracija.\n{FFFFFF}Iveskite norima slaptazodi:",vardas);
ShowPlayerDialog(playerid,201,DIALOG_STYLE_INPUT,"{A3E4FF}Registracija",string,"Registruotis","Atsaukti");
SendClientMessage(playerid, raudona, "[FunZoneLT]>> VEIKIA");
}
if(rows == 1)
{
SendClientMessage(playerid, raudona, "[FunZoneLT]>> hujovai");
//If the rows are equal to 1, this means there is a player already registered
//so we can initiate the login dialog to the player or check if the players
//current IP is the same one as in the database.
new IP[2][16]; //We create a variable with two IP strings, one for retrieving the mysql field and one for GetPlayerIP.
mysql_fetch_field_row(IP[0],"IP");
GetPlayerIp(playerid, IP[1], 16);
if(strlen(IP[0]) != 0 && !strcmp(IP[0], IP[1], true)) //Checks that the MySQL IP has a value and that they are the same.
{
MySQL_Login(playerid);
}
else if(!strlen(IP[0]) || strcmp(IP[0], IP[1], true))
{
format(string, sizeof(string), "{FFFFFF}Zaidejas {FFAF00}%s {FFFFFF}yra registruotas.\n{FFFFFF}Iveskite slaptazodi noredami prisijungti:",vardas);
ShowPlayerDialog(playerid,200,DIALOG_STYLE_INPUT,"{A3E4FF}Prisijungimas",string,"Prisijungti","Atsaukti");
}
}
mysql_free_result();
//You must always free the mysql result to avoid
//there being massive memory usage.
/*if(SaskYra[playerid] == 1)
{
format(string, sizeof(string), "{FFFFFF}Zaidejas {FFAF00}%s {FFFFFF}yra registruotas.\n{FFFFFF}Iveskite slaptazodi noredami prisijungti:",vardas);
ShowPlayerDialog(playerid,200,DIALOG_STYLE_INPUT,"{A3E4FF}Prisijungimas",string,"Prisijungti","Atsaukti");
}
else if(SaskYra[playerid] == 0)
{
format(string, sizeof(string), "{FFFFFF}Zaidejo {FFAF00}%s {FFFFFF}registracija.\n{FFFFFF}Iveskite norima slaptazodi:",vardas);
ShowPlayerDialog(playerid,201,DIALOG_STYLE_INPUT,"{A3E4FF}Registracija",string,"Registruotis","Atsaukti");
}*/
}
else
{
SendClientMessage(playerid, raudona, "[FunZoneLT]>> Jus turite sutikti su taisyklemis, pries zaidziant!");
Kick(playerid);
}
}

