30.05.2012, 12:52
Hellog guys Can somebody help me to convert this MYSQL script into SQL version? REP++;
pawn Код:
new query[200];
format(query, sizeof(query), "SELECT IP FROM `users` WHERE `name` = '%s' LIMIT 1", PlayerName2(playerid));
mysql_query(query);
mysql_store_result();
new rows = mysql_num_rows();
SendClientMessage(playerid, ~1,"Welcome to MySQL Server Test!");
if(!rows)
{
TextDrawSetString(Text:SFSL2[playerid],"~g~~h~] ~r~~h~R~w~egister ~b~~h~A~w~ccount ~g~~h~]");
new rstring[256];
format(rstring,256,""W"Welcome "YE"%s"W", on "NAME_S"\n\n"W"Please "G"Register"W" to save your stats: "COL_ORANGE"Score,Money,Coins...", PlayerName2(playerid));
ShowPlayerDialog(playerid,RegisterDialog,DIALOG_STYLE_PASSWORD,""W"Location:"G" Register Account",rstring,"(Register)","(Quit)");
}
if(rows == 1)
{
new IP[2][16];
mysql_fetch_field_row(IP[0],"IP");
GetPlayerIp(playerid, IP[1], 16);
if(strlen(IP[0]) != 0 && !strcmp(IP[0], IP[1], true))
{
MySQL_Login(playerid);
}
else if(!strlen(IP[0]) || strcmp(IP[0], IP[1], true))
{
new lstring[256];
TextDrawSetString(Text:SFSL2[playerid],"~g~~h~] ~r~~h~L~w~og In ~b~~h~A~w~ccount ~g~~h~]");
format(lstring,256,""W"Welcome back "YE"%s"W", on "NAME_S" "W"server\n\nPlease "R"Login "W"to access your account:", PlayerName2(playerid));
ShowPlayerDialog(playerid,LoginDialog,DIALOG_STYLE_PASSWORD,""W"Location:"G" Account Login",lstring,"(Login)","(Quit)");
AccInfo[playerid][Registered] = 1;
}
}
mysql_free_result(); // Free