21.05.2014, 07:00
pawn Код:
if(dialogid == dlogin) //If dialog id is a login dialog
{//then
if(!response)
{
KickWithMessage(playerid," {FF0000}* You have been kicked - Invalid password. (Change your nick)"); //If they clicked the second button "Quit", we will kick them.
}
if(response) //if they clicked the first button "Register"
{//then
new hashpass[129]; //Will create a new variable to hash his/her password
WP_Hash(hashpass,sizeof(hashpass),inputtext); //Will hash inputted password
if(!strcmp(hashpass,pInfo[playerid][Pass])) //If they have insert their correct password
{//then
INI_ParseFile(Path(playerid),"loadaccount_%s",.bExtra = true, .extra = playerid);//We will load his account's data from user's path
if (pInfo[playerid][Banned] == 1)
{
pInfo[playerid][Banned] =1;
new str1[128];
ban1[playerid] = SetTimerEx("ban", 1000, false, "i", playerid);
SetPlayerScore(playerid,pInfo[playerid][Scores]);//We will get their score inside of his user's account and we will set it here
format(str1,sizeof(str1),"**KICK: %s (%d) (ACCOUNT BANNED) Account Banned", pInfo[playerid][playername], playerid);
SCMA(COLOR_HOTPINK, str1);
KickWithMessage(playerid,"You Have Been Removed From The Server.");
}
if(fexist(UserBanPath(playerid)))
{
INI_ParseFile(UserBanPath(playerid), "LoadBanUser_%s", .bExtra = true, .extra = playerid);
if(pInfo[playerid][pBanPerm]==1)
{
new reso[300];
new targetname[MAX_PLAYER_NAME];
GetPlayerName(playerid,targetname,24);
format(reso,sizeof(reso),"**KICK: %s (%d) (ACCOUNT DISABLED) Account Disabled by Adminstration Reason:%s",pInfo[playerid][playername],playerid,pInfo[playerid][pBanres]);
SCMA(COLOR_HOTPINK,reso);
SetTimerEx("KickPlayer",100,false,"i",playerid);
}
else
{
new d,m,y,h,mi,s;
TimestampToDate(pInfo[playerid][pBanexp],y,m,d,h,mi,s,0,0);//enter the gmt u want where the first 0 is i this statement
if(gettime()>pInfo[playerid][pBanexp])
{
fremove(UserBanPath(playerid));
SCM(playerid,COLOR_BROWN,"You have been unbanned!!!!");
}
else
{
new str[540];
new reso[300];
new targetname[MAX_PLAYER_NAME];
GetPlayerName(playerid,targetname,24);
format(reso,sizeof(reso),"**KICK: %s (%d) (ACCOUNT DISABLED) Account Disabled by Adminstrator",pInfo[playerid][playername],playerid);
format(str,sizeof(str),"This Account Has Been Disabled By An Admin. Reason: %s untill :%i-%i-%i :%i-%i",pInfo[playerid][pBanres],d,m,y,h,mi);
SCM(playerid,COLOR_HOTPINK,str);
SCMA(COLOR_HOTPINK,reso);
SetTimerEx("KickPlayer",100,false,"i",playerid);
}
}
}
else if(fexist(UserIPPath(playerid)))
{
INI_ParseFile(UserIPPath(playerid), "LoadIPUser_%s", .bExtra = true, .extra = playerid);
if(pInfo[playerid][pBanPerm]==1)
{ new reso[256];
SCM(playerid,COLOR_HOTPINK,"This IP is permanently Banned from this server by Administration");
format(reso,sizeof(reso),"Originally Banned Player: {f0f000}%s",pInfo[playerid][pBanIPP]);
SCM(playerid,COLOR_HOTPINK,reso);
format(reso,sizeof(reso),"Reason: %s",pInfo[playerid][pBanres]);
SCM(playerid,COLOR_HOTPINK,reso);
SetTimerEx("KickPlayer",100,false,"i",playerid);
}
else
{
if(gettime() > pInfo[playerid][pBanexp])
{ new pat[100];
fremove(UserIPPath(playerid));
format(pat,sizeof(pat),"Bans/%s.ini",pInfo[playerid][pBanIPP]);
fremove(pat);
SCM(playerid,COLOR_HOTPINK,"This IP was banned but as now the expire time has passed this IP has been unbanned.");
}
else
{
new d,m,y,h,mi,s;
TimestampToDate(pInfo[playerid][pBanexp],y,m,d,h,mi,s,GMT_H,GMT_M);
new str[540];
format(str,sizeof(str),"This IP Has Been Banned By The Adminstration Until %i-%i-%i[Date format : dd/mm/yyyy]",d,m,y);
SCM(playerid,COLOR_HOTPINK,str);
format(str,sizeof(str),"Expires on[TIME] -- %i-%i[Time Format: 24 Hour Clock]",h,mi);
SCM(playerid, COLOR_HOTPINK, str);
format(str,sizeof(str),"Originally Banned Player -- %s",pInfo[playerid][pBanIPP]);
SCM(playerid, COLOR_HOTPINK, str);
format(str,sizeof(str),"Reason -- %s",pInfo[playerid][pBanres]);
SCM(playerid,COLOR_HOTPINK, str);
SetTimerEx("KickPlayer",100,false,"i",playerid);
}
}
}
else
{
INI_ParseFile(Path(playerid),"loadaccount_%s", .bExtra = true, .extra = playerid); //Will load user's data using INI_Parsefile.
SetPlayerScore(playerid,pInfo[playerid][Scores]);//We will get their score inside of his user's account and we will set it here
//SCM(playerid,COLOR_LIME,"You have successfully been logged in.");//Tell them that they've successfully logged in
registered[playerid] =1;
playerloggedin[playerid] =1;
logedinnow[playerid] =1;
if(pInfo[playerid][Adminlevel] >= 1)
{
SCM(playerid,0xFFFFFFFF, "Logged in as an {FF0000}Admin.");
}
else if(pInfo[playerid][Donator] >= 1)
{
SCM(playerid,0xFFFFFFFF, "Logged in as an {FF0000}V.I.P.");
}
else if(pInfo[playerid][DaysAlive] > 30)
{
SCM(playerid,0xFFFFFFFF,"Logged in as an "SKYBLUE"Regular Player");
}
else
{
SCM(playerid,0xFFFFFFFF, "Logged in as an {00FFFF}Registered Player.");
}
}
}
else //If they've entered an incorrect password
{//then
if (failattemps[playerid] == 0)
{
ShowPlayerDialog(playerid,dlogin,DIALOG_STYLE_PASSWORD,"{02FBD6}Login","{FFFFFF}This account is already {02FBD6}registered{FFFFFF} - Please {02FBD6}login{FFFFFF}.\nIf this is not your {E30544}account{FFFFFF}, then quit and change your nick\nin {E30544}SA-MP {FFFFFF}browser.\n{E30544}Invalid password!","Login","Quit");
SCM(playerid, COLOR_RED,"* You have entered wrong password. (1/3) - 2 attemps remaining.");
}
if (failattemps[playerid] == 1)
{
ShowPlayerDialog(playerid,dlogin,DIALOG_STYLE_PASSWORD,"{02FBD6}Login","{FFFFFF}This account is already {02FBD6}registered{FFFFFF} - Please {02FBD6}login{FFFFFF}.\nIf this is not your {E30544}account{FFFFFF}, then quit and change your nick\nin {E30544}SA-MP {FFFFFF}browser.\n{E30544}Invalid password!","Login","Quit");
SCM(playerid, COLOR_RED,"* You have entered wrong password, (2/3) - 1 attemps remaining.");
}
if (failattemps[playerid] == 2)
{
new pname[MAX_PLAYER_NAME], string[120];
GetPlayerName(playerid, pname, sizeof(pname));
ShowPlayerDialog(playerid, fail_login_dialog, DIALOG_STYLE_MSGBOX, "{E30544}Notice", "{FFFFFF}you have reached max login attemps {E30544}(3/3){FFFFFF} - You have been {E30544}kicked{FFFFFF}.\nIf you forgot your {E30544}password{FFFFFF} then contact our staff by following method:\n1). {0087FF}"website" {FFFFFF}- Our website\n2).{0087FF} "support_email" {FFFFFF} - Our support", "Close", "");
if(!strcmp(pname,"Sasuke_Uchiha", true))
{
format(string, sizeof(string),"**Kick: %s (%d) (Fake: Sasuke_Uchiha).",pname,playerid);
SCMA(COLOR_HOTPINK,string);
Kick(playerid);
}
if(!strcmp(pname,"dumb_ass", true))
{
format(string, sizeof(string),"**Kick: %s (%d) (Fake: dumb_ass).",pname,playerid);
SCMA(COLOR_HOTPINK,string);
Kick(playerid);
}
if(!strcmp(pname,"xeeshan", true))
{
format(string, sizeof(string),"**Kick: %s (%d) (Fake: xeeshan).",pname,playerid);
SCMA(COLOR_HOTPINK,string);
Kick(playerid);
}
if(!strcmp(pname,"Gtagangstar", true))
{
format(string, sizeof(string),"**Kick: %s (%d) (Fake: gtagangstar).",pname,playerid);
SCMA(COLOR_HOTPINK,string);
Kick(playerid);
}
if(!strcmp(pname,"brsh@m@", true))
{
format(string, sizeof(string),"**Kick: %s (%d) (Fake: brsh@m@).",pname,playerid);
SCMA(COLOR_HOTPINK,string);
Kick(playerid);
}
else KickWithMessage(playerid," {FF0000}* You have been kicked - Multiple fail login attemps. (3/3) - KICKED");
}
failattemps[playerid]++;
return 1;
}
the ip and ban system is of brozesus