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; }
if(gLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_ERROR, "You are not logged in.");
else { SendClientMessage(playerid, COLOR_ERROR, "You don't have any fish in that slot."); return } |
put under [html]new newcar = GetPlayerVehicleID(playerid);[HTML]
Код HTML:
if(gLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_ERROR, "You are not logged in."); and instead of [html]else return SCM(playerid,-1,"You are not a pizza boy.");[HTML] put this: |
/*CMD:pizza(playerid,params[])
{
new newcar = GetPlayerVehicleID(playerid);
if(vehicleVariables[newcar][vVehicleJob] == 6 && playerVariables[playerid][pJob] == 6)
{
.....
return 1;
}
*/
CMD:pizza(playerid,params[])
{
new newcar = GetPlayerVehicleID(playerid);
if(vehicleVariables[newcar][vVehicleJob] != 6 && 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(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;
return 1;
}
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 |
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
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. |
[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
house = random(systemVariables[houseCount]);
house = random(systemVariables[houseCount]);
printf("house: %i & houseCount: %i", house, systemVariables[houseCount]);