SA-MP Forums Archive
Help me with this - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Help me with this (/showthread.php?tid=651517)



Help me with this - scripter112 - 21.03.2018

How can i make script that creates ini file with player’s ip and in that file saves all nicknames that are joined with this ip


Re: Help me with this - Maximun - 21.03.2018

Can you try that?

PHP код:
//Defines
#define FILE_NAME "here name of the file ini" //File ini directory
//News
new File:hFile;
stock SaveIPuser(playerid
{
    new 
ip[64], pname[24], string[128], str[128];
    
hFile fopen(FILE_NAMEio_write);
    
GetPlayerIp(playeridip64); //Getting the IP of the player
    
GetPlayerName(playeridpname24); // The name of the player
    
format(str256"Pseudo: %s | IP: %s\n\r"pnameip); // The format
    
    
while(fread(hFilestring)) //Reading the file..
    
{
        if(
strcmp(stringpnamefalsestrlen(pname)) == 0// To check if the players name is in the file
        

            
fwrite(hFilestr); // write the string
        
}
        else
        {
            
fwrite(hFilestr);
        }
    }
    
fclose(hFile);

More information? here


Re: Help me with this - scripter112 - 21.03.2018

Quote:
Originally Posted by Maximun
Посмотреть сообщение
Can you try that?

PHP код:
//Defines
#define FILE_NAME "here name of the file ini" //File ini directory
//News
new File:hFile;
stock SaveIPuser(playerid
{
    new 
ip[64], pname[24], string[128], str[128];
    
hFile fopen(FILE_NAMEio_write);
    
GetPlayerIp(playeridip64); //Getting the IP of the player
    
GetPlayerName(playeridpname24); // The name of the player
    
format(str256"Pseudo: %s | IP: %s\n\r"pnameip); // The format
    
    
while(fread(hFilestring)) //Reading the file..
    
{
        if(
strcmp(stringpnamefalsestrlen(pname)) == 0// To check if the players name is in the file
        

            
fwrite(hFilestr); // write the string
        
}
        else
        {
            
fwrite(hFilestr);
        }
    }
    
fclose(hFile);

More information? here
Doesn't work