Find multi Players Account [+++REP]
#1

Hello i want to create an command example
/Showmultiaccount [and IP here]
and get all accounts have the same IP

I try to create but i cant do it
Its hard for mee help mee please

HELP MEE AND I WILL REP YOU
Reply
#2

Quote:
Originally Posted by arlindi
Посмотреть сообщение
Hello i want to create an command example
/Showmultiaccount [and IP here]
and get all accounts have the same IP

I try to create but i cant do it
Its hard for mee help mee please

HELP MEE AND I WILL REP YOU
It depends on what type of saving system you use.
Reply
#3

Witch saving system are you using?
Reply
#4

Its y_INI

And ACcounts are saved in
Scriptfiles/ZMA/Users/%s
With pIP inside
Reply
#5

I don't think there's a direct function with this in y_ini how-ever you can create a .ini file for every IP listing every account that has used it.

From there, you can return the results directly.
Reply
#6

Can to help mee how to create it
But i was thig to find from all accounds the same IP
Nevermind
Help mee how to create it
Reply
#7

AnyOne ? Please
Reply
#8

It's hard to create such a system, especially because default samp functions don't even allow you to list all files in a directory.
So, basically, there is no way to open all account-files one-by-one and reading them until you find the IP in each file.

There is a plugin which could do this, but if you have thousands of players (and thousands accounts), opening/reading/closing them all is way too slow and will lag your server badly.

The best way would be to use MySQL.
One simple query could get all the info you need without even lagging the server as you can use threaded queries.

Reading files isn't threaded and your script has to wait execution of everything else until the file-reading has finished (in case of thousands of accounts, this may take several seconds, if not dozens of seconds, or even minutes, even with a fast harddrive).
Reply
#9

Make a .txt in scriptfiles and store IP of a user in it and retrieve it with that command.
Simple.




P.S: Check if Ladmin has that function or not
Reply
#10

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)