SA-MP Forums Archive
Converting from ZCMD to Strcmp - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Converting from ZCMD to Strcmp (/showthread.php?tid=424928)



Converting from ZCMD to Strcmp - Stanford - 24.03.2013

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


Re: Converting from ZCMD to Strcmp - Stanford - 24.03.2013

any help?


Re: Converting from ZCMD to Strcmp - mastermax7777 - 24.03.2013

u mean from strcmp to zcmd? it would be pretty funny the other way around..
so did u put all ur cmds in commands2convert.txt and send rcon convertzcmd?


Re: Converting from ZCMD to Strcmp - Stanford - 24.03.2013

dude I meant from ZCMD to Strcmp.. I want to replace some stuff in the script to make this happen


Re: Converting from ZCMD to Strcmp - Stanford - 24.03.2013

any help will be appreciated buddies!


Re: Converting from ZCMD to Strcmp - Stanford - 24.03.2013

come on guys!


Re: Converting from ZCMD to Strcmp - fireboy - 24.03.2013

you can do it manual, just change zcmd stuff to strcmp.
pawn Код:
CMD:command(playerid, params[])
{
SendClientMessage(playerid,RED,"yo");
return 1;
}
pawn Код:
if(strcmp(cmdtext, "/command", true) == 0)
{
SendClientMessage(playerid,RED,"yo");
return 1;
}



Re: Converting from ZCMD to Strcmp - por12802 - 24.03.2013

Quote:
Originally Posted by fireboy
Посмотреть сообщение
you can do it manual, just change zcmd stuff to strcmp.
pawn Код:
CMD:command(playerid, params[])
{
SendClientMessage(playerid,RED,"yo");
return 1;
}
pawn Код:
if(strcmp(cmdtext, "/command", true) == 0)
{
SendClientMessage(playerid,RED,"yo");
return 1;
}
Stupid dick head

That u gave an a easier example i know he know

Did u joke?


Re: Converting from ZCMD to Strcmp - Yves - 24.03.2013

dont call someone a dickhead, if he is trying to help you if you got this from a filterscript READ BELOW!


Step 1 : make a folder called commands2convert.txt in your scriptfiles
Step 2 : add your whole onplayercommandtext or just 1 command you want to convert in there
Step 3 : run your server
Step 4 : Load the fliterscript
Step 5 : in console type convertzcmd
Step 6 : your done in scriptfiles you should get a file called convertedcommands.txt which the ZCMD commands converted are in there


Re: Converting from ZCMD to Strcmp - raamiix - 24.03.2013

Код:
CMD:command(playerid, params[])
{
SendClientMessage(playerid,RED,"yo");
return 1;
}