Search in a file map?
#4

Quote:
Originally Posted by big comfy couch
Код:
cmd(listraces, playerid, params[])
{
	new j = 0;
	new filename[64];
	new insert[65];
	new string[128];
	while(ffind("maps/*.txt", filename, sizeof filename, j))
	{
	  format(insert, 65, "|%s", filename);
		for(new x = 0; x < 128; x++)
		{
			if(string[x] != '\0') continue;
			if(strlen(string) + strlen(insert) <= 128)
			{
				strins(string, insert, x);
			}
			else goto add;
		}
		add:
		SendClientMessage(playerid, COLOR_GRAD1, string);
		strdel(string, 0, 128);
		return 1;
	}
	if(strlen(string)) SendClientMessage(playerid, COLOR_GRAD1, string);
}
You need the YSF plugin to use ffind. You also need zcmd. Adjust to your code.
You maybe dont need zcmd. You could use DCMD too i think.

Код:
dcmd_listraces(playerid, params[])
{
	new j = 0;
	new filename[64];
	new insert[65];
	new string[128];
	while(ffind("maps/*.txt", filename, sizeof filename, j))
	{
	  format(insert, 65, "|%s", filename);
		for(new x = 0; x < 128; x++)
		{
			if(string[x] != '\0') continue;
			if(strlen(string) + strlen(insert) <= 128)
			{
				strins(string, insert, x);
			}
			else goto add;
		}
		add:
		SendClientMessage(playerid, COLOR_GRAD1, string);
		strdel(string, 0, 128);
		return 1;
	}
	if(strlen(string)) SendClientMessage(playerid, COLOR_GRAD1, string);
}
Reply


Messages In This Thread
Search in a file map? - by RSC_Quicker - 23.06.2010, 07:16
Re: Search in a file map? - by Lorenc_ - 23.06.2010, 08:35
Re: Search in a file map? - by bigcomfycouch - 23.06.2010, 08:57
Re: Search in a file map? - by Lorenc_ - 23.06.2010, 09:00

Forum Jump:


Users browsing this thread: 1 Guest(s)