24.06.2014, 15:09
Oh I think i've found it:
PHP код:
{
new Query[ 128 ], Name[ MAX_PLAYER_NAME ], EscapedName[ MAX_PLAYER_NAME ];
GetPlayerName( playerid, Name, sizeof( Name ) );
mysql_real_escape_string( Name, EscapedName );
#pragma unused Name
format( Query, sizeof( Query ), "SELECT `UserID` FROM `Accounts` WHERE `Username` = '%s'", EscapedName );
mysql_query( Query );
printf(" SQL: %s",Query);
mysql_store_result();
if( mysql_num_rows() >= 1 )
{
if( mysql_num_rows() >= 2 )
{
mysql_free_result();
SendClientMessage( playerid, COLOR_WHITE, "There seems to be duplicates of your account, please contact a high-level admin." );
SendClientMessage( playerid, COLOR_WHITE, "Best to screenshot this and forum PM a scripter with your ingame name, then they will check it asap." );
Kick( playerid );
}
else
{
PlayerInfo[playerid][pDatabaseID] = mysql_fetch_int();
// Start shit
new string[128];
format( string, sizeof( string ), "{FFFFFF}Welcome, {00C0FF}%s{FFFFFF} !\n\nEnter your password in the box below", GetPlayerNameEx(playerid) );
ShowPlayerDialog( playerid, 1, DIALOG_STYLE_PASSWORD,"{FFFFFF}County RolePlay{FFFFFF}",string, "Login", "Exit" );
SetTimerEx("LogTimer", 60000, 0, "d", playerid);
//TogglePlayerSpectating(playerid, 1);
//InterpolateCameraPos(playerid, 838.256958, -2255.666015, 28.207962, 795.577819, -1796.068237, 58.673408, 1000);
//InterpolateCameraLookAt(playerid, 838.473815, -2250.677001, 27.958066, 796.360046, -1791.334350, 57.266872, 1000);
gPlayerLogged[playerid] = 0;
mysql_free_result();
}
}
else
{
mysql_free_result();
gPlayerLogged[playerid] = 0;
SendClientMessage(playerid, COLOR_LIGHTRED, "You don't have an account registered ! Please Create an account www.county-rp.com!");
SetTimerEx("LogTimer", 6000, 0, "d", playerid);
}
return 1;
}