pawn Код:
case DIALOG_LOGIN: {
if(response) {
new
query[128],
playerName[MAX_PLAYER_NAME],
hashpass[32];
GetPlayerName(playerid, playerName, sizeof(playerName));
mysql_real_escape_string(inputtext, hashpass);
format(query, sizeof(query), "SELECT * FROM `kasutajad` WHERE Nimi='%s' AND Parool=md5('%s')", playerName, hashpass);
mysql_query(query);
mysql_store_result();
if(!mysql_num_rows()) {
SendClientMessage(playerid, -1, ""COLOR_RED"VIGA »"COLOR_WHITE" Teie parool ei klapi, palun kontrollige, et te sisestasite lьnka хige parooli!");
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,
"Logi sisse",
""COLOR_GREY"________________________________________________\n\nTeretulemast tagasi "COLOR_ORANGE"Los Angeles Roleplay"COLOR_GREY" serverisse\n\nEt mдngida, peate esmalt sisse logima\n\n"COLOR_GREY"________________________________________________",
"Login",
"Lahku");
} else {
loginPlayer(playerid);
}
} else {
SendClientMessage(playerid, -1, ""COLOR_ORANGE"Et mдngida siin serveris te peate sisse logima!");
Kick(playerid);
}
}
pawn Код:
stock loginPlayer(playerid) {
new
query[128],
playerName[MAX_PLAYER_NAME],
holdString[32];
GetPlayerName(playerid, playerName, sizeof(playerName));
format(query, sizeof(query), "SELECT * FROM `kasutajad` WHERE Nimi='%s'", playerName);
mysql_query(query);
mysql_store_result();
while(mysql_fetch_row_format(query,"|")) {
mysql_fetch_field_row(holdString, "M2ngutunde"); characterInfo[playerid][M2ngutunde] = strval(holdString);
mysql_fetch_field_row(holdString, "Telefon"); characterInfo[playerid][Telefon] = strval(holdString);
mysql_fetch_field_row(holdString, "TelefoniNumber"); characterInfo[playerid][TelefoniNumber] = strval(holdString);
mysql_fetch_field_row(holdString, "Admin"); characterInfo[playerid][Admin] = strval(holdString);
mysql_fetch_field_row(holdString, "VIP"); characterInfo[playerid][VIP] = strval(holdString);
mysql_fetch_field_row(holdString, "Skin"); characterInfo[playerid][Skin] = strval(holdString);
mysql_fetch_field_row(holdString, "Raha"); characterInfo[playerid][Raha] = strval(holdString);
mysql_fetch_field_row(holdString, "Pank"); characterInfo[playerid][Pank] = strval(holdString);
mysql_fetch_field_row(holdString, "X"); characterInfo[playerid][X] = strval(holdString);
mysql_fetch_field_row(holdString, "Y"); characterInfo[playerid][Y] = strval(holdString);
mysql_fetch_field_row(holdString, "Z"); characterInfo[playerid][Z] = strval(holdString);
mysql_fetch_field_row(holdString, "Sugu"); characterInfo[playerid][Sugu] = strval(holdString);
mysql_fetch_field_row(holdString, "Vanus"); characterInfo[playerid][Vanus] = strval(holdString);
mysql_fetch_field_row(holdString, "KontoSeis"); characterInfo[playerid][KontoSeis] = strval(holdString);
mysql_fetch_field_row(holdString, "streamOption"); characterInfo[playerid][streamOption] = strval(holdString);
mysql_fetch_field_row(holdString, "Kiitus"); characterInfo[playerid][Kiitus] = strval(holdString),
mysql_fetch_field_row(holdString, "Hoiatus"); characterInfo[playerid][Hoiatus] = strval(holdString);
mysql_fetch_field_row(holdString, "Juhiload"); characterInfo[playerid][Juhiload] = strval(holdString);
mysql_fetch_field_row(holdString, "Ajail"); characterInfo[playerid][Ajail] = strval(holdString);
mysql_fetch_field_row(holdString, "Weapon0"); weapon[playerid][0] = strval(holdString);
mysql_fetch_field_row(holdString, "Weapon1"); weapon[playerid][1] = strval(holdString);
mysql_fetch_field_row(holdString, "Weapon2"); weapon[playerid][2] = strval(holdString);
mysql_fetch_field_row(holdString, "Weapon3"); weapon[playerid][3] = strval(holdString);
mysql_fetch_field_row(holdString, "Weapon4"); weapon[playerid][4] = strval(holdString);
mysql_fetch_field_row(holdString, "Weapon5"); weapon[playerid][5] = strval(holdString);
mysql_fetch_field_row(holdString, "Weapon6"); weapon[playerid][6] = strval(holdString);
mysql_fetch_field_row(holdString, "Weapon7"); weapon[playerid][7] = strval(holdString);
mysql_fetch_field_row(holdString, "Weapon8"); weapon[playerid][8] = strval(holdString);
mysql_fetch_field_row(holdString, "Weapon9"); weapon[playerid][9] = strval(holdString);
mysql_fetch_field_row(holdString, "Weapon10"); weapon[playerid][10] = strval(holdString);
mysql_fetch_field_row(holdString, "Weapon11"); weapon[playerid][11] = strval(holdString);
mysql_fetch_field_row(holdString, "Weapon12"); weapon[playerid][12] = strval(holdString);
mysql_fetch_field_row(holdString, "Weapon0Ammo"); weaponAmmo[playerid][0] = strval(holdString);
mysql_fetch_field_row(holdString, "Weapon1Ammo"); weaponAmmo[playerid][1] = strval(holdString);
mysql_fetch_field_row(holdString, "Weapon2Ammo"); weaponAmmo[playerid][2] = strval(holdString);
mysql_fetch_field_row(holdString, "Weapon3Ammo"); weaponAmmo[playerid][3] = strval(holdString);
mysql_fetch_field_row(holdString, "Weapon4Ammo"); weaponAmmo[playerid][4] = strval(holdString);
mysql_fetch_field_row(holdString, "Weapon5Ammo"); weaponAmmo[playerid][5] = strval(holdString);
mysql_fetch_field_row(holdString, "Weapon6Ammo"); weaponAmmo[playerid][6] = strval(holdString);
mysql_fetch_field_row(holdString, "Weapon7Ammo"); weaponAmmo[playerid][7] = strval(holdString);
mysql_fetch_field_row(holdString, "Weapon8Ammo"); weaponAmmo[playerid][8] = strval(holdString);
mysql_fetch_field_row(holdString, "Weapon9Ammo"); weaponAmmo[playerid][9] = strval(holdString);
mysql_fetch_field_row(holdString, "Weapon10Ammo"); weaponAmmo[playerid][10] = strval(holdString);
mysql_fetch_field_row(holdString, "Weapon11Ammo"); weaponAmmo[playerid][11] = strval(holdString);
mysql_fetch_field_row(holdString, "Weapon12Ammo"); weaponAmmo[playerid][12] = strval(holdString);
}
if(characterInfo[playerid][Hoiatus] > 2 || characterInfo[playerid][KontoSeis] == 1) {
SendClientMessage(playerid, -1, "Sinu konto on banned.");
Kick(playerid);
}
if(characterInfo[playerid][Ajail] > 0) {
SendClientMessage(playerid, -1, ""COLOR_LIGHTRED"Sinu admini vangla aeg pole veel lдbi!");
SetPlayerInterior(playerid, 18);
SetPlayerPos(playerid, 1302.519897,-1.787510,1001.028259);
}
for(new i;i<13;i++) {
if(weapon[playerid][i] && weaponAmmo[playerid][i]) {
GivePlayerWeapon(playerid, weapon[playerid][i], weaponAmmo[playerid][i]);
}
}
SendClientMessage(playerid, -1, ""COLOR_GREEN"Olete edukalt sisse logitud, head mдngimist!");
isLogged[playerid] = true;
SetSpawnInfo(playerid, 0, characterInfo[playerid][Skin], characterInfo[playerid][X], characterInfo[playerid][Y], characterInfo[playerid][Z], 0.0, 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);
SetPlayerSkin(playerid, characterInfo[playerid][Skin]);
SetPlayerColor(playerid, 0xFFFFFFFF);
SetPlayerScore(playerid, 1);
SetPlayerPos(playerid, characterInfo[playerid][X], characterInfo[playerid][Y], characterInfo[playerid][Z]);
mysql_free_result();
return true;
}