Quote:
Originally Posted by iAnonymous
Make a .txt in scriptfiles and store IP of a user in it and retrieve it with that command.
Simple.
|
I already told him the exact same thing. He has been given everything he needs to make such a script, how he is able to setup a server is beyond my knowledge.
To the OP:
Since you are so incapable of doing anything for yourself, I will do it for you - but note you need to learn how to do these simple things yourself if you are going to be running your server anytime in the future.
pawn Код:
public OnPlayerLogin(playerid)
{
new pIP[32];
GetPlayerIp(playerid, pIP, sizeof(pIP));
new string[64];
format(string, sizeof(string), "ips/%s.ini", pIP);
if(fexists(string))
{
new File:handle = fopen(string, io_read), buf[128];
if(handle) {
fread(handle, buf);
fclose(handle);
new playerName[32];
GetPlayerName(playerid, playerName, sizeof(playerName));
if(strfind(buf, playerName, true) == 0)
{
return 1;
}
else
{
new File:handle = fopen(string, io_write), buf[128];
if(handle) {
format(string, sizeof(string), "%s\n%s", buf, playerName);
fwrite(handle, string);
fclose(handle);
return 1;
}
}
}
}
else
{
fcreate(string);
new File:handle = fopen(string, io_write), buf[128];
if(handle) {
format(string, sizeof(string), "%s\n%s", buf, playerName);
fwrite(handle, string);
fclose(handle);
return 1;
}
}
return 1;
}
Basically, this logs each IP in it's own .ini file in the IPs folder / directory. This is all I am giving you(unless it doesn't work properly). Thusly, it should be noted that this code is untested.
EDIT: Forget to mention that this works in an OnPlayerLogin callback as it wouldn't log names if people aren't logged in. The last resort ever would be to replace it with a connect-type callback.