Converting from ZCMD to Strcmp
#1

How to make this able to convert from ZCMD to Strcmp, I believe that it's possible.

Код:
#include <a_samp>

public OnFilterScriptInit()
{
	print("\n--------------------------------------");
	print(" Converter");
	print("--------------------------------------\n");
	return 1;
}

public OnRconCommand(cmd[])
{
	if (!strcmp(cmd, "convertzcmd", true))
	{
	    new File:file = fopen("commands2convert.txt", io_read);
	    if (file)
	    {
	        new line[512];
	        while (fread(file, line))
	        {
	            if (strfind(line, "strcmp", true) != -1)
	            {
	                new cmdchar = -1;
	                for(new s; s < strlen(line); s++)
	                {
	                    if (line[s] == '/')
	                    {
	                        cmdchar = s;
	                        break;
	                    }
	                }
	                if (cmdchar != -1 && line[cmdchar+1] != '/')
	                {
	                    new File:c;
			            if (!fexist("convertedcommands.txt")) c = fopen("convertedcommands.txt", io_write);
						else c = fopen("convertedcommands.txt", io_append);
						if ©
						{
						    new cmdname[32];
						    format(cmdname, sizeof cmdname, "%s", line[cmdchar+1]);
						    new end = strfind(cmdname, "\"", true);
						    strdel(cmdname, end, strlen(cmdname));
						    new findbracket = strfind(line, "{", true, cmdchar);
							format(line, sizeof line, "CMD:%s(playerid, params[])", cmdname);
						    if (findbracket != -1) strins(line, "\n{", strlen(line));
						    strins(line, "\n", strlen(line));
							fwrite(c, line);
							fclose©;
							continue;
						}
	                }
	            }
	            new File:c;
	            if (!fexist("convertedcommands.txt")) c = fopen("convertedcommands.txt", io_write);
				else c = fopen("convertedcommands.txt", io_append);
				if ©
				{
					fwrite(c, line);
					fclose©;
				}
	        }
	    }
	}
	return 1;
}
help me and ya get a reputation
Reply


Messages In This Thread
Converting from ZCMD to Strcmp - by Stanford - 24.03.2013, 06:36
Re: Converting from ZCMD to Strcmp - by Stanford - 24.03.2013, 06:52
Re: Converting from ZCMD to Strcmp - by mastermax7777 - 24.03.2013, 06:53
Re: Converting from ZCMD to Strcmp - by Stanford - 24.03.2013, 06:58
Re: Converting from ZCMD to Strcmp - by Stanford - 24.03.2013, 07:04
Re: Converting from ZCMD to Strcmp - by Stanford - 24.03.2013, 07:13
Re: Converting from ZCMD to Strcmp - by fireboy - 24.03.2013, 07:59
Re: Converting from ZCMD to Strcmp - by por12802 - 24.03.2013, 08:28
Re: Converting from ZCMD to Strcmp - by Yves - 24.03.2013, 08:34
Re: Converting from ZCMD to Strcmp - by raamiix - 24.03.2013, 08:50

Forum Jump:


Users browsing this thread: 1 Guest(s)