SA-MP Forums Archive
Unknown Command - 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: Unknown Command (/showthread.php?tid=605204)



Unknown Command - danielpalade - 15.04.2016

This is the command for the job Pizza Boy.
Код:
CMD:pizza(playerid,params[])
{
	new newcar = GetPlayerVehicleID(playerid);
	if(vehicleVariables[newcar][vVehicleJob] == 6 && playerVariables[playerid][pJob] == 6)
	{
		if(playerVariables[playerid][pPiz] == 0)
		{
			IsDeliveringPizza[playerid] = 1;
			new house;
			house = random(systemVariables[houseCount]);
			SetPlayerCheckpoint(playerid, houseVariables[house][hHouseExteriorPos][0], houseVariables[house][hHouseExteriorPos][1], houseVariables[house][hHouseExteriorPos][2], 5.0);
			SendClientMessage(playerid, COLOR_WHITE, "Your working hours is up! Go to red checkpoint.");
			playerVariables[playerid][pPiz] = 120;
		}
		else return SCM(playerid,-1,"You can use pizza every 2 minutes.");
	}
	else return SCM(playerid,-1,"You are not a pizza boy.");
	return 1;
}
After entering the pizza vehicle, and use /pizza, I get the error Unkown Command.
How can I fix this?


Re: Unknown Command - StR_MaRy - 15.04.2016

put under [html]new newcar = GetPlayerVehicleID(playerid);[HTML]

Код HTML:
if(gLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_ERROR, "You are not logged in.");
instead of gLogged put if you have gPlayerLogged , or what you have

and instead of [html]else return SCM(playerid,-1,"You are not a pizza boy.");[HTML]

put this:
Quote:

else
{
SendClientMessage(playerid, COLOR_ERROR, "You don't have any fish in that slot.");
return
}




Re: Unknown Command - danielpalade - 16.04.2016

Quote:
Originally Posted by StR_MaRy
Посмотреть сообщение
put under [html]new newcar = GetPlayerVehicleID(playerid);[HTML]

Код HTML:
if(gLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_ERROR, "You are not logged in.");
instead of gLogged put if you have gPlayerLogged , or what you have

and instead of [html]else return SCM(playerid,-1,"You are not a pizza boy.");[HTML]

put this:
That code doesn't make sense.


Respuesta: Unknown Command - DragonZafiro - 16.04.2016

comment your command
PHP код:
/*CMD:pizza(playerid,params[])
{
    new newcar = GetPlayerVehicleID(playerid);
    if(vehicleVariables[newcar][vVehicleJob] == 6 && playerVariables[playerid][pJob] == 6)
    {
    .....
    return 1;
}
*/ 
then try to use any other command when you're in a vehicle. May be an issue due other commands


Re: Unknown Command - xTURBOx - 16.04.2016

try this
PHP код:
CMD:pizza(playerid,params[])
{
    new 
newcar GetPlayerVehicleID(playerid);
    if(
vehicleVariables[newcar][vVehicleJob] != && playerVariables[playerid][pJob] != 6) return SCM(playerid,-1,"You are not a pizza boy.");
    if(
playerVariables[playerid][pPiz] != 0) return SCM(playerid,-1,"You can use pizza every 2 minutes.");
    
IsDeliveringPizza[playerid] = 1;
    new 
house;
    
house random(systemVariables[houseCount]);
    
SetPlayerCheckpoint(playeridhouseVariables[house][hHouseExteriorPos][0], houseVariables[house][hHouseExteriorPos][1], houseVariables[house][hHouseExteriorPos][2], 5.0);
    
SendClientMessage(playeridCOLOR_WHITE"Your working hours is up! Go to red checkpoint.");
    
playerVariables[playerid][pPiz] = 120;
    return 
1;




Re: Unknown Command - Konstantinos - 16.04.2016

Either the size of vehicleVariables is not MAX_VEHICLES or house has a value greater than the size of houseVariables array.

Either way, loading crashdetect plugin and compiling with debug info should tell you exactly what the problem is:

https://github.com/Zeex/samp-plugin-...es/tag/v4.15.1
https://github.com/Zeex/samp-plugin-...ith-debug-info


Re: Unknown Command - danielpalade - 16.04.2016

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
Either the size of vehicleVariables is not MAX_VEHICLES or house has a value greater than the size of houseVariables array.

Either way, loading crashdetect plugin and compiling with debug info should tell you exactly what the problem is:

https://github.com/Zeex/samp-plugin-...es/tag/v4.15.1
https://github.com/Zeex/samp-plugin-...ith-debug-info
If I use -d3 I get this.

Код:
C:\Program Files (x86)\Compiler\include\sscanf2.inc(305) : warning 218: old style prototypes used with optional semicolumns
C:\Program Files (x86)\Compiler\include\sscanf2.inc(365) : warning 218: old style prototypes used with optional semicolumns
C:\Program Files (x86)\Compiler\include\YSI\y_debug.inc(395) : error 036: empty statement
C:\Program Files (x86)\Compiler\include\YSI\y_debug.inc(395) : error 036: empty statement
C:\Program Files (x86)\Compiler\include\YSI\y_amx.inc(393) : error 036: empty statement
C:\Program Files (x86)\Compiler\include\YSI\y_amx.inc(393) : error 036: empty statement
C:\Program Files (x86)\Compiler\include\YSI\y_amx.inc(437) : error 036: empty statement
C:\Program Files (x86)\Compiler\include\YSI\y_amx.inc(437) : error 036: empty statement
C:\Program Files (x86)\Compiler\include\YSI\y_amx.inc(658) : error 036: empty statement
C:\Program Files (x86)\Compiler\include\YSI\y_amx.inc(658) : error 036: empty statement
C:\Program Files (x86)\Compiler\include\YSI\y_amx.inc(958) : error 036: empty statement
C:\Program Files (x86)\Compiler\include\YSI\y_amx.inc(958) : error 036: empty statement
C:\Program Files (x86)\Compiler\include\YSI\y_amx.inc(966) : error 036: empty statement
C:\Program Files (x86)\Compiler\include\YSI\y_amx.inc(966) : error 036: empty statement
C:\Program Files (x86)\Compiler\include\YSI\y_hooks/impl.inc(198) : error 036: empty statement
C:\Program Files (x86)\Compiler\include\YSI\y_hooks/impl.inc(198) : error 036: empty statement
C:\Program Files (x86)\Compiler\include\YSI\y_hooks/impl.inc(227) : error 036: empty statement
C:\Program Files (x86)\Compiler\include\YSI\y_hooks/impl.inc(227) : error 036: empty statement
C:\Program Files (x86)\Compiler\include\YSI\y_hooks/impl.inc(228) : error 036: empty statement
C:\Program Files (x86)\Compiler\include\YSI\y_hooks/impl.inc(228) : error 036: empty statement
C:\Program Files (x86)\Compiler\include\YSI\y_hooks/impl.inc(239) : error 036: empty statement
C:\Program Files (x86)\Compiler\include\YSI\y_hooks/impl.inc(239) : error 036: empty statement
C:\Program Files (x86)\Compiler\include\YSI\y_hooks/impl.inc(249) : error 036: empty statement
C:\Program Files (x86)\Compiler\include\YSI\y_hooks/impl.inc(249) : error 036: empty statement
C:\Program Files (x86)\Compiler\include\YSI\y_hooks/impl.inc(255) : error 036: empty statement
C:\Program Files (x86)\Compiler\include\YSI\y_hooks/impl.inc(255) : error 036: empty statement
C:\Program Files (x86)\Compiler\include\YSI\y_hooks/impl.inc(274) : error 036: empty statement
C:\Program Files (x86)\Compiler\include\YSI\y_hooks/impl.inc(274) : error 036: empty statement



Re: Unknown Command - Konstantinos - 16.04.2016

Never seen a situation like this before by using "-d3". I guess the warnings in sscanf hit on custom specifiers.

Anyway, as I'm not aware of it then don't use "-d3" flag but let the crashdetect so we can know the last valid index in a run time error 4 and then find which one has the issue.


Re: Unknown Command - danielpalade - 16.04.2016

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
Never seen a situation like this before by using "-d3". I guess the warnings in sscanf hit on custom specifiers.

Anyway, as I'm not aware of it then don't use "-d3" flag but let the crashdetect so we can know the last valid index in a run time error 4 and then find which one has the issue.
This is the output.

Код:
[02:47:52] [debug] Run time error 4: "Array index out of bounds"
[02:47:52] [debug]  Accessing element at index 1044679607 past array upper bound 68
[02:47:52] [debug] AMX backtrace:
[02:47:52] [debug] #0 000abb54 in public cmd_pizza (0, 17624860) from orion.amx
[02:47:52] [debug] #1 native CallLocalFunction () from samp-server.exe
[02:47:52] [debug] #2 000064bc in public OnPlayerCommandText (0, 17624832) from orion.amx



Re: Unknown Command - Konstantinos - 16.04.2016

houseVariables has been declared with size of 69, correct?

pawn Код:
house = random(systemVariables[houseCount]);
house then is used in houseVariables array. Can you debug it?
pawn Код:
house = random(systemVariables[houseCount]);
printf("house: %i & houseCount: %i", house, systemVariables[houseCount]);
What does it print in the console?