Command don't work
#1

Hello, i making this command from Strcmp to Zcmd, and it not working, what is wrong? Please tell me Thx for help

Код:
CMD:newbuycar(playerid, params[])
{
new cmd[128],tmp[128],idx;
cmd = strtok(params,idx);
if(!IsPlayerAdmin(playerid)){return 1;}
tmp = strtok(params,idx);
if(!strlen(tmp)){return 1;}
new vehiclemodel = strval(tmp);
tmp = strtok(params,idx);
if(!strlen(tmp)){return 1;}
new color1 = strval(tmp);
tmp = strtok(params,idx);
if(!strlen(tmp)){return 1;}
new color2 = strval(tmp);
tmp = strtok(params,idx);
if(!strlen(tmp)){return 1;}
new price = strval(tmp);
new Float:px,Float:py,Float:pz,Float:pa;
GetPlayerPos(playerid,px,py,pz);
GetPlayerFacingAngle(playerid,pa);
created++;
VehicleSystem[created][model]=vehiclemodel;
VehicleSystem[created][xa]=px;
VehicleSystem[created][ya]=py;
VehicleSystem[created][za]=pz;
VehicleSystem[created][aa]=pa;
VehicleSystem[created][Farbe1]=color1;
VehicleSystem[created][Farbe2]=color2;
VehicleSystem[created][preis]=price;
strmid(VehicleSystem[created][owner],"dealercar",0,128,128);
new ccar = CreateVehicle(VehicleSystem[created][model],VehicleSystem[created][xa],VehicleSystem[created][ya],VehicleSystem[created][za],VehicleSystem[created][aa],VehicleSystem[created][Farbe1],VehicleSystem[created][Farbe2],600000);
IDIS[ccar]=created;
SaveTool();
SendClientMessage(playerid, 0,"Textas");
return 1;
}
Reply
#2

What errors are you getting?
Reply
#3

No errors, just in game when i write it, it not working.
Reply
#4

To remove all the strtok crap, I would recommend downloading sscanf. ZCMD and sscanf go hand-in-hand. Saves a lot of confusion. Your code would be a lot easier on the eyes.
Reply
#5

Could u help me to make it to zcmd ? This is Strcmp code

Код:
if (strcmp("/newbuycar", cmdtext, true, 10) == 0)
	{
	if(!IsPlayerAdmin(playerid)){return 1;}
	tmp = strtok(cmdtext,idx);
	if(!strlen(tmp)){return 1;}
	new vehiclemodel = strval(tmp);
	tmp = strtok(cmdtext,idx);
	if(!strlen(tmp)){return 1;}
	new color1 = strval(tmp);
	tmp = strtok(cmdtext,idx);
	if(!strlen(tmp)){return 1;}
	new color2 = strval(tmp);
	tmp = strtok(cmdtext,idx);
	if(!strlen(tmp)){return 1;}
	new price = strval(tmp);
	new Float:px,Float:py,Float:pz,Float:pa;
	GetPlayerPos(playerid,px,py,pz);
	GetPlayerFacingAngle(playerid,pa);
	created++;
	VehicleSystem[created][model]=vehiclemodel;
	VehicleSystem[created][x]=px;
	VehicleSystem[created][y]=py;
	VehicleSystem[created][z]=pz;
	VehicleSystem[created][a]=pa;
	VehicleSystem[created][Farbe1]=color1;
	VehicleSystem[created][Farbe2]=color2;
	VehicleSystem[created][preis]=price;
	strmid(VehicleSystem[created][owner],"dealercar",0,128,128);
	new ccar = CreateVehicle(VehicleSystem[created][model],VehicleSystem[created][x],VehicleSystem[created][y],VehicleSystem[created][z],VehicleSystem[created][a],VehicleSystem[created][Farbe1],VehicleSystem[created][Farbe2],600000);
	IDIS[ccar]=created;
	SaveTool();
	return 1;
	}
Reply
#6

I'm not seeing anything wrong with it, but my eyes don't like to sift through all of that. Did you make sure you were logged in to RCON when you tried it?
Reply
#7

Yes. But it not working.
Reply
#8

What is wrong here? Its says that i have createt X, Y, Z, but i only created it one time. Now when i trying to use it, its says -
Код:
C:\Users\Dovydas\Desktop\SAMP MODAS\gamemodes\mysqlGM.pwn(3710) : warning 219: local variable "x" shadows a variable at a preceding level
C:\Users\Dovydas\Desktop\SAMP MODAS\gamemodes\mysqlGM.pwn(3710) : warning 219: local variable "y" shadows a variable at a preceding level
C:\Users\Dovydas\Desktop\SAMP MODAS\gamemodes\mysqlGM.pwn(3710) : warning 219: local variable "z" shadows a variable at a preceding level
C:\Users\Dovydas\Desktop\SAMP MODAS\gamemodes\mysqlGM.pwn(3711) : error 035: argument type mismatch (argument 2)
C:\Users\Dovydas\Desktop\SAMP MODAS\gamemodes\mysqlGM.pwn(3713) : warning 213: tag mismatch
C:\Users\Dovydas\Desktop\SAMP MODAS\gamemodes\mysqlGM.pwn(3713) : warning 213: tag mismatch
C:\Users\Dovydas\Desktop\SAMP MODAS\gamemodes\mysqlGM.pwn(3713) : warning 213: tag mismatch
C:\Users\Dovydas\Desktop\SAMP MODAS\gamemodes\mysqlGM.pwn(3713) : warning 213: tag mismatch
C:\Users\Dovydas\Desktop\SAMP MODAS\gamemodes\mysqlGM.pwn(3710) : warning 203: symbol is never used: "z"
C:\Users\Dovydas\Desktop\SAMP MODAS\gamemodes\mysqlGM.pwn(3710) : warning 203: symbol is never used: "y"
C:\Users\Dovydas\Desktop\SAMP MODAS\gamemodes\mysqlGM.pwn(3710) : warning 203: symbol is never used: "x"
C:\Users\Dovydas\Desktop\SAMP MODAS\gamemodes\mysqlGM.pwn(3868) : warning 219: local variable "x" shadows a variable at a preceding level
C:\Users\Dovydas\Desktop\SAMP MODAS\gamemodes\mysqlGM.pwn(3876) : error 022: must be lvalue (non-constant)
C:\Users\Dovydas\Desktop\SAMP MODAS\gamemodes\mysqlGM.pwn(3876) : warning 215: expression has no effect
C:\Users\Dovydas\Desktop\SAMP MODAS\gamemodes\mysqlGM.pwn(3879) : warning 213: tag mismatch
C:\Users\Dovydas\Desktop\SAMP MODAS\gamemodes\mysqlGM.pwn(3868) : warning 203: symbol is never used: "x"
C:\Users\Dovydas\Desktop\SAMP MODAS\gamemodes\mysqlGM.pwn(3888) : warning 219: local variable "x" shadows a variable at a preceding level
C:\Users\Dovydas\Desktop\SAMP MODAS\gamemodes\mysqlGM.pwn(3894) : error 022: must be lvalue (non-constant)
C:\Users\Dovydas\Desktop\SAMP MODAS\gamemodes\mysqlGM.pwn(3894) : warning 215: expression has no effect
C:\Users\Dovydas\Desktop\SAMP MODAS\gamemodes\mysqlGM.pwn(3897) : warning 213: tag mismatch
C:\Users\Dovydas\Desktop\SAMP MODAS\gamemodes\mysqlGM.pwn(3888) : warning 203: symbol is never used: "x"
Reply
#9

why you don't use sscanf? it's fast and simple.
Reply
#10

First, i don't kow how to make this command to sscanf/zcmd .. please, smwn make this command to sscanf/zcmd
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)