26.07.2014, 22:47
I hope u guys can help me my server has pLogged and now if someone comes on the server say under an admins name then the login dialog comes up but you don't even have to put in a password you just press login and you in the admin account and the players account there is no protection PLEASE HELP!!! Here is the code please have a look.
public OnPlayerRequestSpawn(playerid) //7:1
{
if(pInfo[playerid][pLogged] == 0 && pInfo[playerid][pAdminLevel] >= 1)
{
SendClientMessage(playerid,COLOR_RED,"You must be logged in.");
}
if(pInfo[playerid][pLogged] == 0)
{
new string[128];
GameTextForPlayer(playerid,"~r~YOU MUST LOGIN TO PLAY",1000,4);
if(fexist(UserPath(playerid)))
{
format(string,sizeof(string),""chat" Welcome back %s",PlayerName(playerid));
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,string,""chat" Our system have detected your username registered please login","Login","Quit");
}
else
{
format(string,sizeof(string),""chat" Hello %s to "NAME"",PlayerName(playerid));
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD,string,""chat" Welcome to "NAME" you'll be forced to register please click register!","Register","Quit");
}
}
return 1;
}
public OnPlayerConnect(playerid)
{
if(pInfo[playerid][pAdminDuty] == 1)
{
pInfo[playerid][pAdminDuty] = 0;
}
PlayerPressedJump[playerid] = 0;
playerOnline++;
ResetVars(playerid);
ConnectVars(playerid);
new string[128];
if(fexist(UserPath(playerid)))
{
format(string,sizeof(string),""chat" Welcome back %s",PlayerName(playerid));
}
else
{
format(string,sizeof(string),""chat" Hello %s",PlayerName(playerid));
}
new c2string[128], playerip[16];
GetPlayerIp(playerid, playerip, sizeof(playerip));
format(c2string, sizeof(c2string), ""chat" Player %s[%d] has joined the server "COL_RED"(IP: %s)", PlayerName(playerid), playerid, playerip);
SendMessageToAllAdmins(c2string, -1);
if(pInfo[playerid][pAdminLevel] <= 0)
{
new c2string2[128];
format(c2string2, sizeof(c2string2), ""chat"Player %s[%d] has joined the server", PlayerName(playerid), playerid);
SendClientMessageToAll(COLOR_WHITE, c2string2);
}
if(pInfo[playerid][pBanned] >= 1)
{
new constring[128];
GetPlayerIp(playerid, playerip, sizeof(playerip));
format(constring, sizeof(constring), ""chat" %s You are banned from the server, please make an unban appeal to www.SA-mp.com", PlayerName(playerid));
SendClientMessage(playerid,-1,constring);
Kick(playerid);
}
return 1;
}
public OnPlayerRequestSpawn(playerid) //7:1
{
if(pInfo[playerid][pLogged] == 0 && pInfo[playerid][pAdminLevel] >= 1)
{
SendClientMessage(playerid,COLOR_RED,"You must be logged in.");
}
if(pInfo[playerid][pLogged] == 0)
{
new string[128];
GameTextForPlayer(playerid,"~r~YOU MUST LOGIN TO PLAY",1000,4);
if(fexist(UserPath(playerid)))
{
format(string,sizeof(string),""chat" Welcome back %s",PlayerName(playerid));
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,string,""chat" Our system have detected your username registered please login","Login","Quit");
}
else
{
format(string,sizeof(string),""chat" Hello %s to "NAME"",PlayerName(playerid));
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD,string,""chat" Welcome to "NAME" you'll be forced to register please click register!","Register","Quit");
}
}
return 1;
}
public OnPlayerConnect(playerid)
{
if(pInfo[playerid][pAdminDuty] == 1)
{
pInfo[playerid][pAdminDuty] = 0;
}
PlayerPressedJump[playerid] = 0;
playerOnline++;
ResetVars(playerid);
ConnectVars(playerid);
new string[128];
if(fexist(UserPath(playerid)))
{
format(string,sizeof(string),""chat" Welcome back %s",PlayerName(playerid));
}
else
{
format(string,sizeof(string),""chat" Hello %s",PlayerName(playerid));
}
new c2string[128], playerip[16];
GetPlayerIp(playerid, playerip, sizeof(playerip));
format(c2string, sizeof(c2string), ""chat" Player %s[%d] has joined the server "COL_RED"(IP: %s)", PlayerName(playerid), playerid, playerip);
SendMessageToAllAdmins(c2string, -1);
if(pInfo[playerid][pAdminLevel] <= 0)
{
new c2string2[128];
format(c2string2, sizeof(c2string2), ""chat"Player %s[%d] has joined the server", PlayerName(playerid), playerid);
SendClientMessageToAll(COLOR_WHITE, c2string2);
}
if(pInfo[playerid][pBanned] >= 1)
{
new constring[128];
GetPlayerIp(playerid, playerip, sizeof(playerip));
format(constring, sizeof(constring), ""chat" %s You are banned from the server, please make an unban appeal to www.SA-mp.com", PlayerName(playerid));
SendClientMessage(playerid,-1,constring);
Kick(playerid);
}
return 1;
}