Converting... ZCMD to STRCMP
#1

Can someone convert me this command into STRCMP... ?

Код:
CMD:makesaleveh(playerid, params[])
{
	new vrsta,model,boja1,boja2,cijena;
	if (sscanf(params, "ddddd",vrsta,model,boja1,boja2,cijena)) SCM(playerid, COLOR_WHITE, "Koristenje: /makesaleveh [vrsta] [ModelID] [boja1] [boja2] [cijena]");
	else if(vrsta < 0 || vrsta > 3)  SCM(playerid, COLOR_LIGHTGREEN, "Vrste: 0-Auto,1-Motor,2-Brod,3-Avion");
	else if(model < 400 || model > 611)  SCM(playerid, COLOR_WHITE, "Model vozila nemoze biti ispod 400 i preko 611!");
	else if(boja1 < 0 || boja1 > 126)  SCM(playerid, COLOR_WHITE, "Boja vozila nemoze biti ispod 0 i preko 126!");
	else if(boja2 < 0 || boja2 > 126)  SCM(playerid, COLOR_WHITE, "Boja vozila nemoze biti ispod 0 i preko 126!");
	else if(cijena < 1 || cijena > 99999999)  SCM(playerid, COLOR_WHITE, "Cijena nemoze biti ispod 0!");
	else
	{
	    if(IsPlayerAdmin(playerid))
	    {
			new Float:X,Float:Y,Float:Z,Float:A, s;
			GetPlayerPos(playerid, X,Y,Z);
		 	s = MakeXDCarFnc(playerid,vrsta,model,X+1.5,Y+2.5,Z+2.0,A,boja1,boja2,"Nitko");//THREAD-0=car=bike,2=boat,3=air
		 	MyVehicle[s][MyVehFsale] = cijena;
			SCM(playerid, COLOR_LIGHTRED, "Stvorio si vozilo za prodaju!");
			printf("TYP:%d, ID:%d",vrsta,s);
			UpdateMyVehSystem(s);
		}else{SCM(playerid, COLOR_LIGHTRED, "Niste autorizirani za koristenje ove komande!");}
	}
	return 1;
}

I tried something like this but it has a lot of bugs and didn't worked...
Код:
	if(strcmp(cmdtext, "/makesaleveh", true) == 0)
	{
		new vrsta,model,boja1,boja2,cijena;
		new x_saleveh[256];
		x_saleveh = strtok(cmdtext, idx);
		if(!strlen(x_saleveh))
		{
			SendClientMessage(playerid, COLOR_WHITE, "Koristenje: /makesaleveh [vrsta] [ModelID] [boja1] [boja2] [cijena]");
			if(vrsta < 0 || vrsta > 3)  SendClientMessage(playerid, COLOR_LIGHTGREEN, "Vrste: 0-Auto,1-Motor,2-Brod,3-Avion");
			else if(model < 400 || model > 611)  SendClientMessage(playerid, COLOR_WHITE, "Model vozila nemoze biti ispod 400 i preko 611!");
			else if(boja1 < 0 || boja1 > 126)  SendClientMessage(playerid, COLOR_WHITE, "Boja vozila nemoze biti ispod 0 i preko 126!");
			else if(boja2 < 0 || boja2 > 126)  SendClientMessage(playerid, COLOR_WHITE, "Boja vozila nemoze biti ispod 0 i preko 126!");
			else if(cijena < 1 || cijena > 99999999)  SendClientMessage(playerid, COLOR_WHITE, "Cijena nemoze biti ispod 0!");
		}
	 	if(IsPlayerAdmin(playerid))
		{
			new Float:X,Float:Y,Float:Z,Float:A, s;
			GetPlayerPos(playerid, X,Y,Z);
	 		s = MakeXDCarFnc(playerid,vrsta,model,X+1.5,Y+2.5,Z+2.0,A,boja1,boja2,"Nitko");//THREAD-0=car=bike,2=boat,3=air
	 		MyVehicle[s][MyVehFsale] = cijena;
			SendClientMessage(playerid, COLOR_LIGHTRED, "Stvorio si vozilo za prodaju!");
			printf("TYP:%d, ID:%d",vrsta,s);
			UpdateMyVehSystem(s);
		}
		else
		{
			SendClientMessage(playerid, COLOR_LIGHTRED, "Niste autorizirani za koristenje ove komande!");
		}
		return 1;
	}
Reply
#2

Are you insane? Why are you converting a zcmd into strcmp?

ZCMD is the one of the fastest command processors and strcmp fails so bad!
Reply
#3

Yea i know... But how the fck can i convert 100 STRCMP commands into ZCMD... ?
Reply
#4

Don't you can still have both lol
Reply
#5

no i can't... When i load this ZCMD as filterscript i can, but i want it in gamemode... When i add in gamemode than it won't work...
Reply
#6

First calm down. If you are here to be angry, nobody is going to help you.
Is not hard to conver STRCMP to ZCMD.
Reply
#7

Quote:
Originally Posted by ThePhenix
Посмотреть сообщение
First calm down. If you are here to be angry, nobody is going to help you.
Is not hard to conver STRCMP to ZCMD.
Hehe im not angry... Just my english is poor

Is there any easy way to convert all commands from strcmp into zcmd ?
Reply
#8

Quote:
Originally Posted by ThePhenix
Посмотреть сообщение
First calm down. If you are here to be angry, nobody is going to help you.
Is not hard to conver STRCMP to ZCMD.
Thank you for your advice, the first thing what we need is: "That is not hard". Now close the doors but from the other side, Thank you.

Quote:
Originally Posted by NeroX98
can i convert 100 STRCMP commands into ZCMD... ?
Quote:
Originally Posted by NeroX98
Can someone convert me this command into STRCMP... ?
Determine what do you want.
Reply
#9

Quote:
Originally Posted by Riddick94
Посмотреть сообщение
Thank you for your advice, the first thing what we need is: "That is not hard". Now close the doors but from the other side, Thank you.



Determine what do you want.
First, i want someone to convert this command into STRCMP, cause i have a lot of commands with STRCMP and i can't convert them all to ZCMD.

Second, if there is any easiest way to covert all STRCMP commands to ZCMD than post how to
Reply
#10

Easier way is just convert from string compare to ZeeX's Command processor which is easier to use and better in saving memory and of course a lot faster.

Always if you have got a problem, you MUST check for the same problem on the forum by using forum search function or ****** site.

https://sampforum.blast.hk/showthread.php?tid=280387 - Tutorial how to convert.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)