09.03.2012, 16:35
Hi , i want to set a Ban variable who checks if the Banned =1 kick him from server / else let him connecting so i did that:
i think the problem is here :*
pawn Код:
public OnPlayerLogin(playerid, Password[])
{
if(IsPlayerConnected(playerid)) {
if(strlen(Password) == 0) return ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_PASSWORD, "{00CCFF}Login", "{FFFFFF}Please enter password for login \n\n\n{FF0000}Login is required", "Login", "");
if(strcmp(dini_Get(file[playerid], "Password"), Password, true) == 0) {
IsLogged[playerid] = true;
SendClientMessage(playerid, COLOR_YELLOW, "Welcome Back in Swat 5 Server !");
GivePlayerMoney(playerid, dini_Int(file[playerid], "Money"));
SetPlayerScore(playerid, dini_Int(file[playerid], "Score"));
Vip[playerid] = dini_Int(file[playerid], "Vip");
AdminLevel[playerid] = dini_Int(file[playerid], "Admin");
Banned[playerid] = dini_Int(file[playerid], "IGBAN");
}
else {
ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_PASSWORD, "{00CCFF}Login", "{FF0000}Incorrect Password{FFFFFF}\nplease try again", "Login", "");
}
}
return 1;
}
pawn Код:
public OnPlayerConnect(playerid)
{
if(Banned[playerid] == 1)
{
SendClientMessage(playerid, COLOR_ORANGE,"You are banned !");
Kick(playerid);
}
if(Banned[playerid] == 0)
{
new NAME[100];
SendClientMessageToAll(0xff0000, NAME);
printf("OnPlayerConnect(%d)", playerid);
GetPlayerName(playerid, NAME, 24);
format(NAME, 100, " %s [ID:%d] has connected to the server", NAME, playerid);
SendClientMessageToAll(COLOR_GREY, NAME);
Vip[playerid] = 0;
AdminLevel[playerid] = 0;
if(IsPlayerConnected(playerid) && !IsPlayerNPC(playerid)) {
format(file[playerid], 128, "cs/%s.ini", PlayerName(playerid));
IsLogged[playerid] = false;
if(fexist(file[playerid])) {
ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_PASSWORD, "{00CCFF}Login", "{FFFFFF}Please enter password for login \n\n\n{FF0000}Login is required", "Login", "");
}
}
else {
ShowPlayerDialog(playerid, REGISTER, DIALOG_STYLE_INPUT, "{00CCFF}Registration", "{FFFFFF}Please enter password for registration \n\n\n{FF0000}Registration is required", "Register", "");
}
}
return 1;
}