12.02.2013, 08:35
I have a login problem, when I wrong the password , put me in jail for about 60 seconds.
PHP код:
public OnPlayerLogin(playerid,password[])
{
new hour,minute,second;
gettime(hour,minute,second);
MySQLCheckConnection();
new string2[64];
new tmp2[256];
new parolacript[129];
WP_Hash(parolacript, sizeof(parolacript), password);
MySQLFetchAcctSingle(PlayerData[playerid][pSQLID], "Password", PlayerData[playerid][pKey]);
//format(string2, sizeof(string2), "DEBUG: PASSED1 , Password from MySQL : %s", PlayerData[playerid][pKey]);
//SendClientMessage(playerid, -1, string2);
if(!strcmp(PlayerData[playerid][pKey],parolacript, false) && strlen(parolacript) != 0)
{
//format(string2, sizeof(string2), "DEBUG: PASSED2 , Password from MySQL : %s", password);
//SendClientMessage(playerid, -1, string2);
new Query[255];
format(Query, sizeof(Query), "SELECT * FROM players WHERE id= %d", PlayerData[playerid][pSQLID]);
mysql_query(Query); // Querys the "Query" Variable.
mysql_store_result(); // Stores the result from Query
if(mysql_num_rows()) // Checks if theres anyrow.
if(mysql_fetch_row_format(Query,"|")) // Splits the row
{
sscanf(Query, "p<|>e<is[128]s[64]iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii>",PlayerData[playerid]);
}
MySQLUltLog(PlayerData[playerid][pSQLID], "MarriedTo", PlayerData[playerid][pMarriedTo]);
mysql_store_result();
MySQLUltLog(PlayerData[playerid][pSQLID], "Email", PlayerData[playerid][pEmail]);
mysql_store_result();
}
else
{
new loginstring[128];
new loginname[64];
GetPlayerName(playerid,loginname,sizeof(loginname));
format(loginstring,sizeof(loginstring),"PAROLA GRESITA\nTe rog baga parola corecta:",loginname);
ShowPlayerDialog(playerid,12347,DIALOG_STYLE_PASSWORD,"{1E90FF}L{FFFFFF}ogheaza-te",loginstring,"Login","Exit");
gPlayerLogTries[playerid] += 1;
if(gPlayerLogTries[playerid] == 4) { Kick(playerid); }
return 1;
}
new year, month,day;
getdate(year, month, day);
new string[128];
new query[MAX_STRING];
new zero1[5];
new zero2[5];
new zero3[5];
new zero4[5];
if(hour < 10)
{
zero1 = "0";
}
if(minute < 10)
{
zero2 = "0";
}
if(day < 10)
{
zero3 = "0";
}
if(month < 10)
{
zero4 = "0";
}
format(string, sizeof(string), "%s%d:%s%d %s%d.%s%d.%d",zero1,hour,zero2,minute,zero3,day,zero4,month,year);
strmid(PlayerData[playerid][pUltLog], string, 0, strlen(string), 255);
format(query, sizeof(query), "UPDATE players SET UltLog='%s' WHERE id=%d", PlayerData[playerid][pUltLog], PlayerData[playerid][pSQLID]);
mysql_query(query);
new playersip[32];
GetPlayerIp(playerid, playersip, sizeof(playersip));
format(string, sizeof(string), "UPDATE players SET ip='%s' WHERE id=%d", playersip, PlayerData[playerid][pSQLID]);
mysql_query(string);
if(PlayerData[playerid][pPcarkey] == 0)
{
PlayerData[playerid][pPcarkey] = 999;
format(query, sizeof(query), "UPDATE players SET Car='%d' WHERE id=%d", PlayerData[playerid][pPcarkey], PlayerData[playerid][pSQLID]);
mysql_query(query);
}
if(PlayerData[playerid][pPcarkey2] == 0)
{
PlayerData[playerid][pPcarkey2] = 999;
format(query, sizeof(query), "UPDATE players SET Car2='%d' WHERE id=%d", PlayerData[playerid][pPcarkey2], PlayerData[playerid][pSQLID]);
mysql_query(query);
}
if(PlayerData[playerid][pPcarkey3] == 0)
{
PlayerData[playerid][pPcarkey3] = 999;
format(query, sizeof(query), "UPDATE players SET Car3='%d' WHERE id=%d", PlayerData[playerid][pPcarkey3], PlayerData[playerid][pSQLID]);
mysql_query(query);
}
//mysql_free_result();
PlayerData[playerid][pAdjustable] = 0;
ConsumingMoney[playerid] = 1;
if(PlayerData[playerid][pReg] == 0)
{
PlayerData[playerid][pLevel] = 1;
PlayerData[playerid][pSHealth] = 0.0;
PlayerData[playerid][pHealth] = 50.0;
PlayerData[playerid][pArmour] = 0.0;
PlayerData[playerid][pPos_x] = 2246.6;
PlayerData[playerid][pPos_y] = -1161.9;
PlayerData[playerid][pPos_z] = 1029.7;
PlayerData[playerid][pInt] = 15;
PlayerData[playerid][pLocal] = 255;
PlayerData[playerid][pTeam] = 3;
PlayerData[playerid][pModel] = 264;
new randphone = 1000000 + random(8999999);//minimum 1000 max 9999 //giving one at the start
PlayerData[playerid][pPnumber] = randphone;
PlayerData[playerid][pPhousekey] = 255;
PlayerData[playerid][pPbiskey] = 255;
PlayerData[playerid][pPcarkey] = 999;
PlayerData[playerid][pAccount] = 5000;
PlayerData[playerid][pReg] = 1;
PlayerData[playerid][pLocked] = 0;
GivePlayerCash(playerid, 1000);
format(string, sizeof(string), "UPDATE players SET Registered='%d' WHERE id=%d", PlayerData[playerid][pReg], PlayerData[playerid][pSQLID]);
mysql_query(string);
format(string, sizeof(string), "UPDATE players SET PhoneNr='%d' WHERE id=%d", PlayerData[playerid][pPnumber], PlayerData[playerid][pSQLID]);
mysql_query(string);
format(string, sizeof(string), "UPDATE players SET House='%d' WHERE id=%d", PlayerData[playerid][pPhousekey], PlayerData[playerid][pSQLID]);
mysql_query(string);
format(string, sizeof(string), "UPDATE players SET Car='%d' WHERE id=%d", PlayerData[playerid][pPcarkey], PlayerData[playerid][pSQLID]);
mysql_query(string);
format(string, sizeof(string), "UPDATE players SET Bank='%d' WHERE id=%d", PlayerData[playerid][pAccount], PlayerData[playerid][pSQLID]);
mysql_query(string);
format(string, sizeof(string), "UPDATE players SET Locked='%d' WHERE id=%d", PlayerData[playerid][pLocked], PlayerData[playerid][pSQLID]);
mysql_query(string);
}
printf(" %s has logged in.", PlayerData[playerid][pNume]);
getdate(year, month, day);
gettime(hour,minute,second);
GetPlayerIp(playerid,playersip,sizeof(playersip));
//format(string, sizeof(string), "AdmCmd: %s s-a logat astazi %d/%d/%d ora %d:%d, de pe ip %s",PlayerData[playerid][pNume],month,day,year,hour,minute,playersip);
//ConnectLog(string);
// format(string, sizeof(string), "INSERT INTO ConnectLog (Nume, Data, IP, Tip) VALUES ('%s', '%s', '%s', 'Logare')", PlayerData[playerid][pNume], PlayerData[playerid][pUltLog], playersip);
mysql_query(string);
PlayerData[playerid][pStatus] = 1;
format(string, sizeof(string), "UPDATE players SET Status='%d' WHERE id=%d", PlayerData[playerid][pStatus], PlayerData[playerid][pSQLID]);
mysql_query(string);
if(PlayerData[playerid][pAllowed] == 0)
{
for(new i=1; i<=maxim;i++)
{
if(strfind(playersip, BanData[i][xIp], true) != -1)
{
SendClientMessage(playerid, COLOR_WHITE, "Server: {FF0000}Ai primit ban pe aceasta clasa de ip.");
SendClientMessage(playerid, COLOR_LIGHTRED, "Pentru unban viziteaza sa-zone.com");
Kick(playerid);
return 1;
}
}
}
getdate(year, month, day);
new hourr,minutee,secondd;
gettime(hourr,minutee,secondd);
if(Registerr[playerid] == 2)
{
new stringg[128];
format(stringg, sizeof(stringg), "%d %d %d",day,month,year);
strmid(PlayerData[playerid][pDateReg], stringg, 0, strlen(stringg), 255);
format(query, sizeof(query), "UPDATE players SET DateReg='%s' WHERE id=%d", stringg, PlayerData[playerid][pSQLID]);
Registerr[playerid] = 0;
mysql_query(query);
//mysql_free_result();
}
if (PlayerData[playerid][pDonateRank] > 0 && PlayerData[playerid][pAdmin] < 1 && PlayerData[playerid][pAgent] < 1)
{
SendClientMessage(playerid, COLOR_LIGHTBLUE, "[Server]: Esti donator.");
}
if (PlayerData[playerid][pAdmin] >= 1 && PlayerData[playerid][pDonateRank] < 1 && PlayerData[playerid][pAgent] < 1)
{
format(string2, sizeof(string2), "[Server]: Te-ai logat. Esti admin level %d.", PlayerData[playerid][pAdmin]);
SendClientMessage(playerid, COLOR_LIGHTBLUE,string2);
}
if (PlayerData[playerid][pAdmin] >= 1 && PlayerData[playerid][pDonateRank] > 0 && PlayerData[playerid][pAgent] < 1)
{
format(string2, sizeof(string2), "[Server]: Te-ai logat. Esti donator si admin level %d.", PlayerData[playerid][pAdmin]);
SendClientMessage(playerid, COLOR_LIGHTBLUE,string2);
}
if (PlayerData[playerid][pAdmin] >= 1 && PlayerData[playerid][pDonateRank] > 0 && PlayerData[playerid][pAgent] > 0)
{
format(string2, sizeof(string2), "[Server]: Te-ai logat. Esti donator,helper si admin level %d.", PlayerData[playerid][pAdmin]);
SendClientMessage(playerid, COLOR_LIGHTBLUE,string2);
}
if (PlayerData[playerid][pAgent] >= 1 && PlayerData[playerid][pDonateRank] < 1 && PlayerData[playerid][pAdmin] < 1)
{
format(string2, sizeof(string2), "[Server]: Te-ai logat. Esti helper.");
SendClientMessage(playerid, COLOR_LIGHTBLUE,string2);
}
if (PlayerData[playerid][pAgent] >= 1 && PlayerData[playerid][pDonateRank] > 0 && PlayerData[playerid][pAdmin] < 1)
{
format(string2, sizeof(string2), "[Server]: Te-ai logat. Esti donator si helper.");
SendClientMessage(playerid, COLOR_LIGHTBLUE,string2);
}
WantedLevel[playerid] = PlayerData[playerid][pWantedLevel];
WantedPoints[playerid] = PlayerData[playerid][pWantedPoints];
SetPlayerWantedLevel(playerid, PlayerData[playerid][pWantedLevel]);
if (PlayerData[playerid][pWantedLevel] > 0)
{
format(string2, sizeof(string2), "SERVER: Ai primit inapoi %d stele!",WantedLevel[playerid]);
SendClientMessage(playerid, COLOR_LIGHTRED, string2);
}
SendClientMessage(playerid, COLOR_YELLOW, "Va rugam sa vizitati: sa-zone.com");
TextDrawShowForPlayer(playerid,sitetd);
TextDrawHideForPlayer(playerid, Textdraw773);
TextDrawHideForPlayer(playerid, Textdraw772);
TextDrawHideForPlayer(playerid,logintd0);
TextDrawHideForPlayer(playerid,logintd1);
TextDrawHideForPlayer(playerid,logintd2);
TextDrawHideForPlayer(playerid,logintd3);
TextDrawHideForPlayer(playerid,logintd4);
TextDrawHideForPlayer(playerid,logintd5);
PlayerData[playerid][pLocked] = 0;
SetCameraBehindPlayer(playerid);
if(gTeam[playerid] == 0)
{
gTeam[playerid] = 3;
}
else
{
gTeam[playerid] = PlayerData[playerid][pTeam];
}
gPlayerLogged[playerid] = 1;
GivePlayerMoney(playerid, -GetPlayerMoney(playerid));
SetPlayerCash(playerid);
// SetSpawnInfo(playerid, PlayerData[playerid][pTeam], PlayerData[playerid][pModel], 1641.2795,-2239.7483,13.4972, 182.3683, 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);
format(tmp2, sizeof(tmp2), "~w~ Welcome %s",PlayerData[playerid][pNume]);
StopAudioStreamForPlayer(playerid);
GameTextForPlayer(playerid, tmp2, 5000, 1);
SendClientMessage(playerid, COLOR_YELLOW, motd);
//elogat[playerid] = true;
//LoadPlayerAchievements(playerid);
return 1;
}