01.03.2012, 03:54
pawn Код:
CMD:ban(playerid, params[])
{
if (PlayerInfo[playerid][pAdmin] >= 2)
{
new string[128], ID, reason[64];
if(sscanf(params, "us[64]", ID, reason)) return SendClientMessage(playerid, COLOR_GRAD1, "BAN USAGE: /ban id reason");
if(IsPlayerConnected(giveplayerid))
{
if(PlayerInfo[ID][pAdmin] > PlayerInfo[playerid][pAdmin])
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "%s Been banned! Attempting to ban a higher level administrator!", name);
SendClientMessageToAll(COLOR_BAN, string);
PlayerInfo[ID][pBanned] ++;
return 1;
}
else
{
new pip[16], File:ftw=fopen("Bannedips.txt", io_write);
new BIP= GetPlayerIp(playerid, pip, sizeof(pip));
format(string,sizeof(string)," %i banned for %s\r\n", BIP, reason);
SendClientMessageToAll(COLOR_BAN, string);
fwrite(ftw, string);
fclose(ftw);
return 1;
}
}
}
else SendClientMessage(playerid, COLOR_GRAD1, "Invalid player specified.");
return 1;
}
how would I do this?
I know I would do
pawn Код:
new File:ftw=fopen("Bannedips.txt", io_read);
// what do I do here to see if the users ip is on the list,
//kicks the player if the ip is on the list


