Serach users from ini files -
GuyYahood1 - 25.01.2014
Hello all,
I want to find some users and I know part of name I don't know how to do search in ini files only with part of name users.
like this:
[R]Worson.txt
how can I do it?
Re : Serach users from ini files -
MCZOFT - 25.01.2014
go to your gamemod derictory/scriptfiles/users/you'll find there the users.ini ( most servers use this system)
Re: Serach users from ini files -
GuyYahood1 - 25.01.2014
I don't use in users.ini, if player register to server that's open new txt file I want do command to find all of txt files with part of name - Loop.
Re : Serach users from ini files -
MCZOFT - 25.01.2014
i dont get your idea 100 percent , but i would say , go to your gamemod / registration system , whene player register(put his password and logins ) find the write"file.txt" system you'll find ther fopen("file..."); and his path,
Re: Serach users from ini files -
Threshold - 25.01.2014
I don't actually know if this is possible with Y_INI, I mean obviously it would be possible in some way, but it would be a shit load of loops and data usage etc.
The best option is to go with MySQL or SQLite, which for your convenience, I don't have very much experience in. I'm fairly sure this is possible in MySQL without some bitch-ass code to fill your entire script.
Re: Serach users from ini files -
Shetch - 25.01.2014
https://sampwiki.blast.hk/wiki/Strfind
Re: Serach users from ini files -
GuyYahood1 - 25.01.2014
I have 3,000 users, I can't do it now. What about 3000 users ?
I mean to this:
PHP код:
if(!strcmp(cmd,"/fineuser",true))
{
format(string,sizeof(string),"Users/%s.txt",/*part of name*/);
if(!DOF2_FileExists(string)) return SendClientMessage(playerid,COLOR_RED,"Invalid Name.");
for(new i; i < 3000; i++)
{
//the closest name
format(string,sizeof(string),"%s");
}
return 1;
}
I do not know how to make it because it's hard for me to give you a simpler example.
Understood ?
Re: Serach users from ini files -
Threshold - 25.01.2014
The only way this would be possible with strfind is if you had a text file that contained the names of every single player that has registered to your server.
pawn Код:
//OnPlayerRegister
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
new str[30];
format(str, sizeof(str), "%s\r\n", name);
new File:text = fopen("Players.txt", io_append);
fwrite(text, str);
fclose(text);
//Continue..
//Example with ZCMD of how you would use it:
CMD:findplayer(playerid, params[])
{
if(!strlen(params) || strlen(params) > MAX_PLAYER_NAME) return SendClientMessage(playerid, 0xFF0000FF, "USAGE: /findplayer [part of name]");
new count = 0, File:text = fopen("Players.txt", io_read), string[50];
format(string, sizeof(string), "Player Names Containing '%s'", params);
SendClientMessage(playerid, 0x00FF00FF, string);
while(fread(text, string))
{
if(strfind(string, params, true) != -1)
{
SendClientMessage(playerid, 0xFFFF00FF, string);
count++;
}
}
if(count == 0) return SendClientMessage(playerid, 0xFF0000FF, "No matches found.");
return 1;
}
Should work.
Re: Serach users from ini files -
GuyYahood1 - 25.01.2014
Thank you very much.
Do I understand correctly that there is no other way?