[HELP] Need to remove the mysql -
V4at - 03.05.2012
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);
}
}
Re: [HELP] Need to remove the mysql -
Accord - 03.05.2012
what do you mean?
Re : [HELP] Need to remove the mysql -
V4at - 03.05.2012
Remove MYSQL
Re: [HELP] Need to remove the mysql -
Accord - 03.05.2012
Mysql given you the ability to save it on your website, without any using in mysql the jail will remove after disconnected from your server.
Re: [HELP] Need to remove the mysql -
KingHual - 03.05.2012
Note that I've changed some of the if statements too.
pawn Код:
if(dialogid == 201)
{/*
new vardas[MAX_PLAYER_NAME];
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");
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)
{
}
}
else
{
SendClientMessage(playerid, raudona, "[FunZoneLT]>> Jus turite uzsiregistruoti serveryje, pries zaidziant!");
Kick(playerid);
}
}
if(dialogid == 200)
{
if(response) //If the player clicked login
{
new pname[24], escapepass[100]; //
GetPlayerName(playerid, pname, 24); //Gets the players name
//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(/*incorrect pass*/)
{
//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");
}
}
else
{
SendClientMessage(playerid, raudona, "[FunZoneLT]>> Jus turite prisijungti prie serverio, pries zaidziant!");
Kick(playerid);
}
pawn Код:
}
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 pname[24]; //Creates our variables.
GetPlayerName(playerid, pname, 24); //Gets the players name
SendClientMessage(playerid, raudona, "[FunZoneLT]>> NEVEIKIA!!!");
if(/*must register*/)
{
//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.
GetPlayerIp(playerid, IP[1], 16);
if(/*IPs match*/) //Checks that the MySQL IP has a value and that they are the same.
{
//autologin
}
else if(/*IPs don't match*/)
{
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");
}
}
/*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);
}
}
Re : [HELP] Need to remove the mysql -
V4at - 03.05.2012
I know but I need to remove it, because before a server was without mysql and everything worked, but my friend decided to make a mysql and did not complete. Now he has no time and I do not know anything about mysql
Re : [HELP] Need to remove the mysql -
V4at - 03.05.2012
yet this is the:
Код:
if(response)
{
new vardas[MAX_PLAYER_NAME];
GetPlayerName(playerid, vardas, sizeof(vardas));
new query[ 128 ], EscapedPass[ 128 ], sstring[50];
if(!strlen(inputtext)) return ShowPlayerDialog(playerid,200,DIALOG_STYLE_INPUT,"{A3E4FF}Prisijungimas","{FFFFFF}Jus neivedete slaptazodzio.\n{FFFFFF}Prasome ivesti slaptazodi, kad galetumete prisijungti.","Prisijungti","Atsaukti");
if(strlen(inputtext) < 3 || strlen(inputtext) >= 32)
return ShowPlayerDialog(playerid,200,DIALOG_STYLE_INPUT,"{A3E4FF}Prisijungimas","{FFFFFF}Slaptazodis yra per trumpas arba per ilgas.\n{FFFFFF}Prasome ivesti teisinga slaptazodi, kad galetumete prisijungti!","Prisijungti","Atsaukti");
mysql_real_escape_string( inputtext, EscapedPass );
format(query,sizeof(query), "SELECT * FROM `Saskaitos` WHERE `Vardas` = '%s' AND `Slaptazodis` = '%s'", vardas, EscapedPass );
mysql_query( query );
mysql_store_result();
if( mysql_num_rows() >= 1 )
{
prisijunges[playerid] = 1;
SendClientMessage(playerid, geltona, "[FunZoneLT]>> Jus prisijungete! Sekmes zaidime jums linki Administracijos komanda!");
if(ALygis[playerid] >= 1)
{
Alabel[playerid] = Create3DTextLabel("Administratorius", raudona,30.0,40.0,50.0,40.0,0);
Attach3DTextLabelToPlayer(Alabel[playerid], playerid, 0.0, 0.0, 0.7);
}
}
else
{
ShowPlayerDialog(playerid,200,DIALOG_STYLE_INPUT,"{A3E4FF}Prisijungimas","{FFFFFF}Jus ivedete neteisinga slaptazodi.\n{FFFFFF}Prasome ivesti teisinga slaptazodi, kad galetumete prisijungti!","Prisijungti","Atsaukti");
}
//ZStats[playerid][Adminas] = strval(field[2]);
//ZStats[playerid][Pinigai] = strval(field[3]);
//GivePlayerMoney(playerid, ZStats[playerid][Pinigai]);
mysql_free_result();
//new row[128];
//new field[7][32];
new row[128];
new field[7][32];
//mysql_fetch_row_format(row, "|");
while(mysql_fetch_row_format(query,"|"))
{
//We use while so that it does a single query, not multiple
//Especially when we have more variables. If there is more
//Variables, you should just split the line with sscanf. To
//Make it easier.
mysql_fetch_field_row(sstring, "Pinigai"); DuotiPinigus[playerid] = strval(sstring);
//If you are wondering why I'm using savingstring instead
//Of a variable like using MoneyGiven right away, it's because
//mysql_fetch_field_row requires a string.
}
GivePlayerMoney(playerid, DuotiPinigus[playerid]);
explode(row, field, "|");
mysql_free_result();
format(ZStats[playerid][Slaptazodis], 32, "%s", field[1]);
// ZStats[playerid][Adminas] = strval(field[2]);
// ZStats[playerid][Pinigai] = strval(field[3]);
//ZStats[playerid][Smasina] = strval(field[7]);
// GivePlayerMoney(playerid, ZStats[playerid][Pinigai]);
CheckMySQL();
//new vardas[MAX_PLAYER_NAME];
//GetPlayerName(playerid, vardas, sizeof(vardas));
//format(string, sizeof(string), "UPDATE Saskaitos SET Smasina= 1 WHERE Vardas='%s'", vardas );
// mysql_query(string);
// mysql_free_result();
}
else
{
SendClientMessage(playerid, raudona, "[FunZoneLT]>> Jus turite prisijungti prie serverio, pries zaidziant!");
Kick(playerid);
}*/
Re: [HELP] Need to remove the mysql -
ikey07 - 03.05.2012
Dont steal cmds and make your own :P