21.03.2018, 17:48
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
//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_NAME, io_write);
GetPlayerIp(playerid, ip, 64); //Getting the IP of the player
GetPlayerName(playerid, pname, 24); // The name of the player
format(str, 256, "Pseudo: %s | IP: %s\n\r", pname, ip); // The format
while(fread(hFile, string)) //Reading the file..
{
if(strcmp(string, pname, false, strlen(pname)) == 0) // To check if the players name is in the file
{
fwrite(hFile, str); // write the string
}
else
{
fwrite(hFile, str);
}
}
fclose(hFile);
}
Can you try that?
PHP код:
|