function PlayerLogin(playerid,step)
{
new string[256],playersip[64];
GetPlayerIp(playerid,playersip, 64);
switch(step)
{
case 0:
{
mysql_format(SQL,string,128,"SELECT * FROM `bans` WHERE `ip`='%s' LIMIT 1",playersip);
mysql_tquery(SQL,string,"BanInfoo","di",playerid,0);
}
case 1:
{
mysql_format(SQL,string,128,"SELECT * FROM `bans` WHERE `Player`='%s' LIMIT 1",PlayerData[playerid][Name]);
mysql_tquery(SQL,string,"BanInfoo","di",playerid,1);
}
case 2:
{//Succes
SetPlayerScore(playerid, PlayerData[playerid][Level]);
if (PlayerData[playerid][WantedLevel] > 0)
{
format(string, sizeof(string), "Ai primit inapoi nivelul de wanted care-l aveai inainte sa iesi (%d).",PlayerData[playerid][WantedLevel]);
SendClientMessage(playerid, COLOR_LIGHTRED, string);
UpdateWanted(playerid);
}
SetPlayerPos(playerid, 1443.0547,-1114.1348,93.8248);
SpawnPlayer(playerid);
SetPlayerSkin(playerid,PlayerData[playerid][Char]);
GivePlayerMoney(playerid, -GetPlayerMoney(playerid));
SetPlayerCash(playerid);
new hours, minutes, year, month, day;
new datestr[128], timestr[32];
gettime(hours, minutes);
getdate(year, month, day);
format(string, sizeof(string), "%02d.%02d.%02d %02d:%02d",day,month,year,hours,minutes);
strmid(PlayerData[playerid][LastLog], string, 0, strlen(string), 255);
PlayerData[playerid][online] = 1;
mysql_format(SQL, string,128,"UPDATE `users` SET `LastLogin`='%s',`online`='%d' WHERE `ID`='%d' LIMIT 1",PlayerData[playerid][LastLog],PlayerData[playerid][online],PlayerData[playerid][ID]);
mysql_tquery(SQL, string, "", "");
format(string, sizeof(string), "%s has logged in from IP: %s", PlayerData[playerid][Name],playersip);
printf(string);
new country[40], isp[40], city[40];
GetPlayerCountry(playerid, country, sizeof(country));
GetPlayerISP(playerid, isp, sizeof(isp));
GetPlayerCity(playerid, city, sizeof(city));
if(strcmp(isp, "ROMTELECOM S.A") == 0 || strcmp(isp, "RCS & RDS S.A.") == 0)
{
strmid(country, "Romania", 0, strlen("Romania"), 999);
}
strmid(PlayerData[playerid][ipCountry], country, 0, strlen(country), 999);
strmid(PlayerData[playerid][ipCity], city, 0, strlen(city), 999);
strmid(PlayerData[playerid][ipISP], isp, 0, strlen(isp), 999);
mysql_format(SQL, string,256,"UPDATE `users` SET `ipCountry`='%s',`ipCity`='%s',`ipISP`='%s' WHERE `ID`='%d' LIMIT 1",PlayerData[playerid][ipCountry],PlayerData[playerid][ipCity],PlayerData[playerid][ipISP],PlayerData[playerid][ID]);
mysql_tquery(SQL, string, "", "");
for( new j = 0; j <= 100; j++) {
SendClientMessage(playerid, COLOR_WHITE, "");
}
new szQuery[256], szString[256], Cache: results;
format(szQuery, sizeof(szQuery), "SELECT * FROM `friends` WHERE `AddBy` = '%d'", PlayerData[playerid][ID]);
results = mysql_query(SQL, szQuery);
foreach(Player, i) {
if(IsPlayerConnected(i)) {
format(szQuery, sizeof(szQuery), "SELECT * FROM `friends` WHERE `AddBy` = '%d' AND `friendID` = '%d'", PlayerData[ID], PlayerData[playerid][ID]);
results = mysql_query(SQL, szQuery);
cache_get_field_content(0, "AddBy", szString);
new friendID = strval(szString);
cache_delete(results);
if(PlayerData[ID] == friendID && friendID != 0) {
format(szString, sizeof(szString), "Prietenul tau, %s, s-a logat.", GetName(playerid), playerid);
SendClientMessage(i, COLOR_YELLOW, string);
}
}
}
format(string, sizeof(string), "Bine ai (re)venit, %s!",GetName(playerid));
SendClientMessage(playerid, COLOR_WHITE, string);
LoginLog(playerid,playersip,country,city,isp);
if(PlayerData[playerid][Mission] == -1) {
PlayerData[playerid][Mission] = 2+random(7), PlayerData[playerid][MissionProgress] = 0;
SaveMissions(playerid);
}
new status1[256];
if(PlayerData[playerid][MissionProgress] >= GetNeedProgress(playerid, 0)) format(status1, 256, "Misiune terminata");
else format(status1, 256, "%d/%d", PlayerData[playerid][MissionProgress], GetNeedProgress(playerid, 0));
format(string, sizeof(string), "Misiunea zilei: '%s' (Progres: %s).", MissionName[PlayerData[playerid][Mission]], status1);
SendClientMessage(playerid, COLOR_YELLOW, string);
new clanid = PlayerData[playerid][Clan];
if(clanid != 0) {
format(string, sizeof(string), "{%s}(Clan): %s.", ClanInfo[clanid][clColor], ClanInfo[PlayerData[playerid][Clan]][clMotd]);
SendClientMessage(playerid, -1, string);
}
if(PlayerData[playerid][Clan] != 0 && ClanInfo[clanid][clTagType] == 0) {
format(string, sizeof(string), "%s%s", ClanInfo[clanid][clTag], PlayerData[playerid][Name]);
SetPlayerName(playerid, string);
}
else if(PlayerData[playerid][Clan] != 0 && ClanInfo[clanid][clTagType] == 1) {
format(string, sizeof(string), "%s%s", PlayerData[playerid][Name], ClanInfo[clanid][clTag]);
SetPlayerName(playerid, string);
}
gettime(hours, minutes);
getdate(year, month, day);
format(datestr,128,"%02d/%02d/%d", day, month, year);
format(timestr,32,"~w~%02d:%02d",hours,minutes);
TextDrawSetString(txtTimeDisp,timestr);
TextDrawSetString(txtDateDisp,datestr);
PlayerData[playerid][IsLoggedIn] = true;
SetPlayerVirtualWorld(playerid, 0);
if(PlayerData[playerid][Tutorial] == 0)
{
SetPlayerPos(playerid, 1443.0547,-1114.1348,93.8248);
SetPlayerCameraPos(playerid, 1481.4355, -1368.9164, 243.5123);
SetPlayerCameraLookAt(playerid, 1480.5366, -1368.4688, 243.1123);
SetPlayerInterior(playerid, 0);
TogglePlayerControllable(playerid, 0);
new szDialog[1024];
format(szDialog, sizeof(szDialog), "Te rog sa alegi o limba pentru a trece la pasul urmator. O vei putea schimba mai tarziu cu /language.");
ShowPlayerDialog(playerid, DIALOG_LANGUAGE, DIALOG_STYLE_MSGBOX, "Limba:", szDialog, "English", "Romana");
}
AFKLoggin[playerid] = -1;
if(PlayerData[playerid][Admin] != 0) Iter_Add(Admins, playerid);
if(PlayerData[playerid][Helper] != 0) Iter_Add(Helpers, playerid);
if(PlayerData[playerid][Leader] != 0) Iter_Add(Leaders, playerid);
if(strlen(PlayerData[playerid][Pin]) == 0) {
SendClientMessage(playerid, COLOR_LIGHTBLUE, "* Pentru o securitate cat mai mare a contului tau, iti poti pune un PIN format din 4 cifre.");
SendClientMessage(playerid, COLOR_LIGHTBLUE, "* Foloseste comanda '/setpin' pentru a-ti pune un PIN!");
}
else {
SendClientMessage(playerid, COLOR_LIGHTBLUE, "* Contul tau are un PIN setat. Foloseste comanda '/loginpin' pentru a pune codul de securitate.");
}
}
}
return 1;
}
function BanInfoo(playerid,step)
{
switch(step)
{
case 0:
{
if(cache_num_rows() > 0)
{
GameTextForPlayer(playerid, "~r~IP BANAT", 5000, 5);
SendClientMessage(playerid,0xA9C4E4FF,"Acest IP este banat.");
SendClientMessage(playerid,0xA9C4E4FF,"Poti face o cerere pe forum-ul nostru (www.edison-project.ro)");
KickEx(playerid);
}
else PlayerLogin(playerid,1);
}
case 1:
{
if(PlayerData[playerid][Banned] == 0){ PlayerLogin(playerid,2); return 1; }
new adminban[25],banneddatee[50],reason[25],time, string[128];
new UD, UM, UY, UH, UMi;
cache_get_field_content(0, "Admin", adminban, SQL, 129);
cache_get_field_content(0, "BannedDate", banneddatee, SQL, 129);
cache_get_field_content(0, "reason", reason, SQL, 129);
time = cache_get_field_content_int(0, "time");
UD = cache_get_field_content_int(0, "UD");
UM = cache_get_field_content_int(0, "UM");
UY = cache_get_field_content_int(0, "UY");
UH = cache_get_field_content_int(0, "UH");
UMi = cache_get_field_content_int(0, "UMi");
if(PlayerData[playerid][Banned] == 1)
{//Temporar
new annres = IsAccBanned(UY,UM,UD,UH,UMi);
if(annres == 3)
{//Still banned
GameTextForPlayer(playerid, "~r~CONT BANAT", 5000, 5);
format(string, sizeof(string), "Contul tau este banat de %s pentru %d zile, motiv: %s (%s).",adminban,time,reason,banneddatee);
SendClientMessage(playerid,0xA9C4E4FF,string);
SendClientMessage(playerid,0xA9C4E4FF,"Poti face o cerere pe forum-ul nostru (www.edison-project.ro)");
KickEx(playerid);
return 1;
}
if(annres == 2)
{//Unban
PlayerData[playerid][Banned] = 0;
mysql_format(SQL,string,128,"UPDATE `users` SET `Banned`='0' WHERE `username`='%s'",PlayerData[playerid][Name]);
mysql_tquery(SQL,string, "", "");
mysql_format(SQL,string,128,"DELETE FROM `bans` WHERE `Player`='%s'",PlayerData[playerid][Name]);
mysql_tquery(SQL,string, "", "");
ServerInfo[banned]--;
mysql_format(SQL,string, sizeof(string),"UPDATE `infos` SET `banned`='%d' WHERE ID = 1",ServerInfo[banned]);
mysql_tquery(SQL,string, "", "");
PlayerLogin(playerid,2);
}
}
if(PlayerData[playerid][Banned] == 2)
{//Permanent
GameTextForPlayer(playerid, "~r~CONT BANAT", 5000, 5);
format(string, sizeof(string), "Contul tau este banat de %s, motiv: %s (%s).",adminban,reason,banneddatee);
SendClientMessage(playerid,0xA9C4E4FF,string);
SendClientMessage(playerid,0xA9C4E4FF,"Poti face o cerere pe forum-ul nostru (www.edison-project.ro)");
KickEx(playerid);
}
}
}
return 1;
}