24.03.2013, 06:36
How to make this able to convert from ZCMD to Strcmp, I believe that it's possible.
help me and ya get a reputation
Код:
#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;
}


