26.10.2011, 19:38
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == DIALOG_LOGIN)
{
if(response == 0)
{
Kick(playerid);
}
else
{
new query[300], password[128];
format(query, sizeof(query), "SELECT `Password` FROM `Accounts` WHERE id = %d", PlayerSQLID[playerid]);
mysql_query(query);
mysql_store_result();
mysql_fetch_row(password);
mysql_free_result();
if(strcmp(password, inputtext, false) == 0)
{
PreloadAnimLib(playerid,"BOMBER");
PreloadAnimLib(playerid,"RAPPING");
PreloadAnimLib(playerid,"SHOP");
PreloadAnimLib(playerid,"BEACH");
PreloadAnimLib(playerid,"SMOKING");
PreloadAnimLib(playerid,"ON_LOOKERS");
PreloadAnimLib(playerid,"DEALER");
PreloadAnimLib(playerid,"CRACK");
PreloadAnimLib(playerid,"CARRY");
PreloadAnimLib(playerid,"COP_AMBIENT");
PreloadAnimLib(playerid,"PARK");
PreloadAnimLib(playerid,"INT_HOUSE");
PreloadAnimLib(playerid,"FOOD");
PreloadAnimLib(playerid,"GANGS");
PreloadAnimLib(playerid,"PED");
PreloadAnimLib(playerid,"FAT");
LoggedIn[playerid] = 1;
PlayerBanned[playerid] = MySQL_GetValue(PlayerSQLID[playerid], "Banned", "Accounts");
if(PlayerBanned[playerid] == 1)
{
SendClientMessage(playerid, COLOUR_RED, "You are banned from this server.");
Kick(playerid);
return 1;
}
PlayerLevel[playerid] = MySQL_GetValue(PlayerSQLID[playerid], "Level", "Accounts");
SetPlayerScore(playerid, PlayerLevel[playerid]);
PlayerMoney[playerid] = MySQL_GetValue(PlayerSQLID[playerid], "Money", "Accounts");
ResetPlayerMoney(playerid);
GivePlayerMoney(playerid, PlayerMoney[playerid]);
AdminLevel[playerid] = MySQL_GetValue(PlayerSQLID[playerid], "AdminLevel", "Accounts");
PlayerArmour[playerid] = MySQL_GetValue(PlayerSQLID[playerid], "Armour", "Accounts");
SetPlayerArmour(playerid, PlayerArmour[playerid]);
Faction[playerid] = MySQL_GetValue(PlayerSQLID[playerid], "Faction", "Accounts");
FRank[playerid] = MySQL_GetValue(PlayerSQLID[playerid], "FRank", "Accounts");
SetSpawnInfo(playerid, -1, PlayerSkin[playerid], -227.3866, 1039.8873, 19.7422, 180.0, 0,0,0,0,0,0);
SpawnPlayer(playerid);
new string[256];
format(string, sizeof(string), "Welcome to Bone County Roleplay %s : Level: %d Money: $ %d Admin Level: %d Faction: %s Faction Rank: %d", GetNameEx(playerid), PlayerLevel[playerid], PlayerMoney[playerid], AdminLevel[playerid], FactionName[Faction[playerid]], FRank[playerid]);
SendClientMessage(playerid, 0xFFD99FFF, string);
}
else
{
new string[128];
format(string, sizeof(string), "Welcome to %s\n\nYou entered a wrong password, please try again:", HOSTNAME);
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, "Login Dialog", string, "Login", "Leave");
}
}
}