SA-MP Forums Archive
[HELP] CheckGas issue - 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: [HELP] CheckGas issue (/showthread.php?tid=367422)



[HELP] CheckGas issue - Riddy - 09.08.2012

Код:
forward CheckGas();
public CheckGas()
{

//	new string[128];
	foreach (Player, i)
	{
		if(GetPlayerState(i) == PLAYER_STATE_DRIVER) {
			if(AdminDuty[i]) continue;
			new vehicle = GetPlayerVehicleID(i);
			if (VehicleEngine[vehicle] == 1 && !IsNotAEngineCar(vehicle)) {
			if(CarInfo[VehicleOwned[vehicle]][cFuel] >= 1 && Gas[vehicle] >= 1) {

					if(NoFuel[i] == 0) {

						SendDebugMessage("Checkgas, Fuel Minus");
					}
					CarInfo[VehicleOwned[vehicle]][cFuel] -= 1;
					Gas[vehicle] -= 1;
				}
				else {
					VehAsk[i] = 1;
					TogglePlayerControllable(i, 0);
					InfoBoxForPlayer(i,"~w~~n~~n~~n~~n~~n~~n~~n~~n~~n~No fuel in Vehicle");
					SendDebugMessage("Checkgas, No Fuel");
				}
			}
		}
	}
	return 1;
}
[00:21:12] [debug] #0 00018ef0 in public CheckGas () from HE_RP.amx
[00:21:12] [debug] AMX backtrace:
[00:21:12] [debug] Accessing element at index 2001 past array upper bound 1999