PDA

View Full Version : Is this kind of reading possible?


liinor
19/07/2012, 10:53 AM
Text in Ban.ini
192.168.0.10 liinor lol
OnPlayerConnect


new ConnIP[50];
new server_IP[50];
GetPlayerIp(playerid,ConnIP,50);
format(server_IP, 50, "%d",ConnIP);
new banreason[256];
new string2[64]; // Create the string to store the read text in


new lol[100];
new named[100];
new fileip[100];

new File:example = fopen("Bans.Ini", io_read); // Open the file
while(fread(example, string2)) //reads the file line-by-line
{
format(string2, sizeof(string2), "%d %s %d",fileip,named,banreason);


if(strcmp(string2, ConnIP, true) == 0) //if any of the lines in the file say "Ban" the system will ban the player
{



format(lol,sizeof(lol),"%s who got ban on that ip %s",banreason,named);
SendClientMessage(playerid,COLOR_RED,lol);
SendClientMessage(playerid,COLOR_ORANGE,"You are banned from the server!");
//Kick(playerid);
break;
}

}
fclose(example);

please i need help.