public OnPlayerLogin(playerid,password[])
{
new tmp2[256];
new string2[64];
new string[128];
new playersip[24];
new playername2[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername2, sizeof(playername2));
GetPlayerIp(playerid, playersip, sizeof(playersip));
format(string2, sizeof(string2), "users/%s.ini", playername2);
new File: UserFile = fopen(string2, io_read);
if ( UserFile )
{
new PassData[256];
new keytmp[256], valtmp[256];
fread( UserFile , PassData , sizeof( PassData ) );
keytmp = ini_GetKey( PassData );
if( strcmp( keytmp , "Key" , true ) == 0 )
{
valtmp = ini_GetValue( PassData );
strmid(PlayerInfo[playerid][pKey], valtmp, 0, strlen(valtmp)-1, 255);
}
if(strcmp(PlayerInfo[playerid][pKey],password, true ) == 0 )
{
new key[ 256 ] , val[ 256 ];
new Data[ 256 ];
while ( fread( UserFile , Data , sizeof( Data ) ) )
{
key = ini_GetKey( Data );
if( strcmp( key , "Level" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pLevel] = strval( val ); }
if( strcmp( key , "AdminLevel" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pAdmin] = strval( val ); }
if( strcmp( key , "HelperLevel" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pHelper] = strval( val ); }
if( strcmp( key , "Sex" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pSex] = strval( val ); }
if( strcmp( key , "Origin" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pOrigin] = strval( val ); }
if( strcmp( key , "Age" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pAge] = strval( val ); }
if( strcmp( key , "Model" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pModel] = strval( val ); }
if( strcmp( key , "Team" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pTeam] = strval( val ); }
if( strcmp( key , "Cash" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pCash] = strval( val ); }
if( strcmp( key , "SpawnLoc" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pSpawnLoc] = strval( val ); }
if( strcmp( key , "FMember" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pFMember] = strval( val ); }
if( strcmp( key , "Int" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pInt] = strval( val ); }
if( strcmp( key , "Local" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pLocal] = strval( val ); }
if( strcmp( key , "Member" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pMember] = strval( val ); }
if( strcmp( key , "Leader" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pLeader] = strval( val ); }
if( strcmp( key , "Rank" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pRank] = strval( val ); }
if( strcmp( key , "Char" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pChar] = strval( val ); }
if( strcmp( key , "Jailed" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pJailed] = strval( val ); }
if( strcmp( key , "JailTime" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pJailTime] = strval( val ); }
if( strcmp( key , "Tut" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pTut] = strval( val ); }
if( strcmp( key , "Origin" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pOrigin] = strval( val ); }
if( strcmp( key , "Muted" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pMuted] = strval( val ); }
if( strcmp( key , "Warns" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pWarns] = strval( val ); }
if( strcmp( key , "Bani" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pBani] = strval( val ); }
if( strcmp( key , "Acont" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pAcont] = strval( val ); }
if( strcmp( key , "MuteTime" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pMuteTime] = strval( val ); }
if( strcmp( key , "VirWorld" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pVirWorld] = strval( val ); }
if( strcmp( key , "WantedPoints" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pWantedPoints] = strval( val ); }
if( strcmp( key , "WantedDeaths" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pWantedDeaths] = strval( val ); }
if( strcmp( key , "PayCheck" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pPayCheck] = strval( val ); }
if( strcmp( key , "Locked" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pLocked] = strval( val ); }
if( strcmp( key , "AD" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pAD] = strval( val ); }
if( strcmp( key , "Mats" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pMats] = strval( val ); }
if( strcmp( key , "Drugs" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pDrugs] = strval( val ); }
if( strcmp( key , "Exp" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pExp] = strval( val ); }
if( strcmp( key , "AWarns" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pAWarns] = strval( val ); }
if( strcmp( key , "LeaderWarns" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pLeaderWarns] = strval( val ); }
if( strcmp( key , "FACWarns" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pFACWarns] = strval( val ); }
if( strcmp( key , "Carkey" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pPcarkey] = strval( val ); }
if( strcmp( key , "Carkey2" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pPcarkey2] = strval( val ); }
if( strcmp( key , "Carkey3" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pPcarkey3] = strval( val ); }
if( strcmp( key , "CarSkill" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pCarSkill] = strval( val ); }
}
fclose(UserFile);
}
else
{
new loginstring[128];
new loginname[64];
gPlayerLogTries[playerid] += 1;
GetPlayerName(playerid,loginname,sizeof(loginname));
format(loginstring,sizeof(loginstring),"{FFFFFF}Parola {F81414}gresita\n{FFFFFF}Te rugam sa introduci parola corecta\n{FFFFFF}Ai introdus gresit {FA0021}%d/4 {F81414}Kick {FFFFFF}!",gPlayerLogTries[playerid],loginname);
ShowPlayerDialog(playerid,12347,DIALOG_STYLE_INPUT,"{0080FF}Login",loginstring,"Login","Exit");
fclose(UserFile);
format(loginstring, 256, "{FFAF00}[{FFFFFF}Login{FFAF00}]{FFFFFF}: {6EF83C}%s {FFFFFF}IP{6EF83C}[{FFFFFF}%s{6EF83C}] {FFFFFF}a gresit parola la logare", loginname, playersip);
ABroadCast(COLOR_YELLOW2,loginstring,1);
if(gPlayerLogTries[playerid] >= 1)
{
format(string, sizeof(string), "{FFAF00}[{FFFFFF}Login{FFAF00}]{FFFFFF}: Daca gresesti parola de 4 ori consecutiv primesti kick. Ai gresit de {FA0021}%d/4 {FFFFFF}ori !",gPlayerLogTries[playerid]);
SendClientMessage(playerid, COLOR_WHITE, string);
}
if(gPlayerLogTries[playerid] == 4)
{
Kick(playerid);
}
return 1;
}
ResetPlayerMoney(playerid);
ConsumingMoney[playerid] = 1;
GivePlayerMoney(playerid,PlayerInfo[playerid][pCash]);
CurrentMoney[playerid] = PlayerInfo[playerid][pCash];
if(PlayerInfo[playerid][pLevel] == -999) //autoban
{
Ban(playerid);
}
SendClientMessage(playerid, COLOR_RED, "=====================================================");
format(string2, sizeof(string2), "{0049FF}[{F3FF02}ExtremHosting{0049FF}]{FFFFFF}: Bine ai venit {FFFF80}%s",playername2);
SendClientMessage(playerid, COLOR_WHITE,string2);
printf("%s has logged in.",playername2);
SpawnPlayer(playerid);
if (PlayerInfo[playerid][pAdmin] > 0)
{
format(string2, sizeof(string2), "{0049FF}[{F3FF02}ExtremHosting{0049FF}]{FFFFFF}: Teai connectat ca admin level {FFFF80}%d ",PlayerInfo[playerid][pAdmin]);
SendClientMessage(playerid, COLOR_WHITE,string2);
}
SendClientMessage(playerid, COLOR_RED, "=====================================================");
if(gTeam[playerid] == 0)
{
gTeam[playerid] = 3;
}
else
{
gTeam[playerid] = PlayerInfo[playerid][pTeam];
}
if(WantedLevel[playerid] >= 1)
{
new wanted = WantedLevel[playerid];
new sendername[MAX_PLAYER_NAME];
GetPlayerName(playerid, sendername, sizeof(sendername));
if(wanted > 0)
{
format(string,sizeof(string), "{0049FF}[{F3FF02}ExtremHosting{0049FF}]{FFFFFF}: Cand ai iesit sau ai luat crash aveai Wanted Level {6EF83C}%d{FFFFFF}, asa ca l`ai primit inapoi !", wanted);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
format(string,sizeof(string), "{0049FF}[{F3FF02}ExtremHosting{0049FF}]{FFFFFF}: {6EF83C}%s {FFFFFF}a revenit pe server si are Wanted Level {6EF83C}%d {FFFFFF}!", sendername, wanted);
SendTeamMessage(2, 0x00ACB2AA, string);
}
}
if(PlayerInfo[playerid][pLocked] == 1) // Auto-kick
{
SendClientMessage(playerid, COLOR_LIGHTRED, "{0049FF}[{F3FF02}ExtremHosting{0049FF}]{FFFFFF}: Nu ai primit unban !");
Kick(playerid);
}
if(PlayerInfo[playerid][pSpawnLoc] == 0)
{
PlayerInfo[playerid][pSpawnLoc] = 1;
}
gPlayerLogged[playerid] = 1;
SetPlayerSpawn(playerid);
format(tmp2, sizeof(tmp2), "~w~Welcome ~n~~y~ %s", playername2);
//DateProp(playerid);
GameTextForPlayer(playerid, tmp2, 5000, 1);
SendClientMessage(playerid, COLOR_YELLOW, motd);
}
return 1;
}
Does the server get crashed? If so, load crashdetect plugin to see what is wrong with it. Compile with the debug mode, so it'll be easier to find the problem (it sometimes shows lines it caused at).
|