SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 19/07/2012, 10:53 AM   #1
liinor
Big Clucker
 
liinor's Avatar
 
Join Date: Dec 2009
Location: Finland
Posts: 119
Reputation: 5
Question Is this kind of reading possible?

Text in Ban.ini
192.168.0.10 liinor lol
OnPlayerConnect
pawn Code:
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.
__________________
Horse betting script in sa-mp.
http://forum.sa-mp.com/showthread.php?t=606985
Real Clock Speedometer
https://www.youtube.com/watch?v=A2C4...ature=youtu.be
liinor is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to have this kind of IP Ballu Miaa Scripting Help 22 29/12/2011 10:01 PM
A kind of bug. ilikehotgirl Help Archive 2 30/01/2011 09:40 AM
Some kind of bug or something ? xemper Server Support 0 18/01/2011 04:06 PM


All times are GMT. The time now is 08:07 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.