07.08.2011, 23:47
(
Последний раз редактировалось Kingunit; 11.09.2011 в 20:31.
)
<fixed>
public OnPlayerSpawn(playerid)
{
if(Player[playerid][Banned] == 1)
{
Kick(playerid)
SendClientMessage(playerid,-1,"You are banned have a good life :P.");
}
return 1;
}
public OnPlayerConnect(playerid)
{
new file[128], pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
format(file, sizeof(file), "Users/%s.ini", pName);
if(!fexist(file))
{
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "Please Register", "Enter Your Password Below", "Register", "Cancel");
}
else
{
Player[playerid][Banned] = dini_Int(file, "Banned");
if(Player[playerid][Banned] == 0)
{
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Please Login", "Enter Your Password Below", "Login", "Cancel");
}
else
{
SendClientMessage(playerid, RED, "You are banned gtfo");
Kick(playerid);
}
}
return 1;
}
new file[32],Name[32];//Variable declaration, don't declare it here, just make a new one at the top of the script, this is just for the purpose of helping you.
GetPlayerName(playerid,Name,sizeof(Name));// Getting the player's name.
format(file,sizeof(file),"Accounts/%s.ini",Name);//You can see where I have 'Accounts' change that to the name of the folder in which the files are stored.
PlayerData[playerid][Banned] = dini_Int(file, "Banned");//This is storing what's in the file, into the Player[playerid][Banned] variable.