21.02.2012, 11:57
(
Последний раз редактировалось ArmyOps; 21.02.2012 в 12:37.
)
If il put wrong password, i get message of wrong password, but if i logg in with right password after the first fail, it says that "Im succefully logged in" but im staying in "TogglePlayerSpectating"
But if i do it first time correctly it works fine. How can i fix it? here is the login stock:
But if i do it first time correctly it works fine. How can i fix it? here is the login stock:
pawn Код:
stock MySQL_Login(playerid)
{
new query[300], pname[24], savingstring[20];
GetPlayerName(playerid, pname, 24);
format(query, sizeof(query), "SELECT PlayerLevel, PlayerAdmin, Score, Vip, Sex, Age, Origin, Money, Bank, PhoneBook, PhoneNr, LottoNr, House, Biz, Car, Bike, HouseKey, BizKey, CarKey, BikeKey, Posx, Posy, Posz, Posa FROM Player WHERE user = '%s'", pname);
mysql_query(query);
mysql_store_result();
while(mysql_fetch_row_format(query,"|"))
{
mysql_fetch_field_row(savingstring, "PlayerLevel"); PlayerInfo[playerid][pLevel] = strval(savingstring);
mysql_fetch_field_row(savingstring, "PlayerAdmin"); PlayerInfo[playerid][pAdmin] = strval(savingstring);
mysql_fetch_field_row(savingstring, "Score"); SetPlayerScore(playerid, strval(savingstring));
mysql_fetch_field_row(savingstring, "Vip"); PlayerInfo[playerid][pVip] = strval(savingstring);
mysql_fetch_field_row(savingstring, "Sex"); PlayerInfo[playerid][pSex] = strval(savingstring);
mysql_fetch_field_row(savingstring, "Age"); PlayerInfo[playerid][pAge] = strval(savingstring);
mysql_fetch_field_row(savingstring, "Origin"); PlayerInfo[playerid][pOrigin] = strval(savingstring);
mysql_fetch_field_row(savingstring, "Money"); MoneyGiven[playerid] = strval(savingstring);
mysql_fetch_field_row(savingstring, "Bank"); PlayerInfo[playerid][pBank] = strval(savingstring);
mysql_fetch_field_row(savingstring, "PhoneBook"); PlayerInfo[playerid][pPhoneBook] = strval(savingstring);
mysql_fetch_field_row(savingstring, "PhoneNr"); PlayerInfo[playerid][pPhoneNr] = strval(savingstring);
mysql_fetch_field_row(savingstring, "LottoNr"); PlayerInfo[playerid][pLottoNr] = strval(savingstring);
mysql_fetch_field_row(savingstring, "House"); PlayerInfo[playerid][pHouse] = strval(savingstring);
mysql_fetch_field_row(savingstring, "Biz"); PlayerInfo[playerid][pBiz] = strval(savingstring);
mysql_fetch_field_row(savingstring, "Car"); PlayerInfo[playerid][pCar] = strval(savingstring);
mysql_fetch_field_row(savingstring, "Bike"); PlayerInfo[playerid][pBike] = strval(savingstring);
mysql_fetch_field_row(savingstring, "HouseKey"); PlayerInfo[playerid][pHouseKey] = strval(savingstring);
mysql_fetch_field_row(savingstring, "BizKey"); PlayerInfo[playerid][pBizKey] = strval(savingstring);
mysql_fetch_field_row(savingstring, "CarKey"); PlayerInfo[playerid][pCarKey] = strval(savingstring);
mysql_fetch_field_row(savingstring, "BikeKey"); PlayerInfo[playerid][pBikeKey] = strval(savingstring);
mysql_fetch_field_row(savingstring, "Posx"); PlayerInfo[playerid][pPosX] = strval(savingstring);
mysql_fetch_field_row(savingstring, "Posy"); PlayerInfo[playerid][pPosY] = strval(savingstring);
mysql_fetch_field_row(savingstring, "Posz"); PlayerInfo[playerid][pPosZ] = strval(savingstring);
mysql_fetch_field_row(savingstring, "Posa"); PlayerInfo[playerid][pPosA] = strval(savingstring);
}
mysql_free_result();
Logged[playerid] = 1;
JustLogged[playerid] = 1;
PlayerInfo[playerid][pLogins]++;
SendMessage(playerid, "~g~Info: ~w~You have been logged-in!");
return 1;
}
pawn Код:
if(dialogid == DIALOG_LOGIN)
{
if(!response)
{
SendClientMessage(playerid, COLOR_WHITE, "Sa valisid 'Katkesta', taaskдivita mдng, et uuesti proovida !");
TogglePlayerSpectating(playerid, 1);
Kick(playerid);
}
if(response)
{
new query[200], pname[24], escapepass[100];
GetPlayerName(playerid, pname, 24);
mysql_real_escape_string(inputtext, escapepass);
format(query, sizeof(query), "SELECT `Name` FROM Player WHERE Name = '%s' AND Password = SHA1('%s')", pname, escapepass);
mysql_query(query);
mysql_store_result();
new numrows = mysql_num_rows();
if(numrows == 1) MySQL_Login(playerid);
if(!numrows)
{
SendMessage(playerid, "~r~Error: ~w~Vale parool!");
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, ""Blue"Please log-in", ""White"Welcome back to "Red""SERVER_NAME""White"!\n"White"In order to start playing, you have to log-in!\n\n"White"Please insert "Red"your"White" password below:", "Login", "Cancel");
}
mysql_free_result();
}
return 1;
}
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
if(!Logged[playerid])
{
if(!JustLogged[playerid])
{
TogglePlayerSpectating(playerid, 1);
}
if(JustLogged[playerid] == 1)
{
SetSpawnInfo( playerid, 0, 0, 1958.33, 1343.12, 15.36, 269.15, 26, 36, 28, 150, 0, 0 );
SpawnPlayer(playerid);
}
}
return 1;
}