SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 13/04/2016, 03:56 PM   #1
skiplovebra
Huge Clucker
 
Join Date: Sep 2015
Posts: 288
Reputation: 0
Default debug] Run time error 4: "Array index out of bounds"

Code:
[13/04/2016 12:47:28] [debug] Run time error 4: "Array index out of bounds"
[13/04/2016 12:47:28] [debug]  Accessing element at negative index -1
[13/04/2016 12:47:28] [debug] AMX backtrace:
[13/04/2016 12:47:28] [debug] #0 0046e308 in ?? (0x00000010) from NGRP.amx
[13/04/2016 12:47:28] [debug] #1 00010cc8 in public OnPlayerEnterCheckpoint (0x00000010) from NGRP.amx
Code:
public OnPlayerEnterCheckpoint(playerid)
{
    if(IsPlayerInRangeOfPoint(playerid, 10, -309.0990,-1381.1797,10.7049) && GetVehicleModel(GetPlayerVehicleID(playerid)) == 532)
 	{
 		DisablePlayerCheckpoint(playerid);
		SendClientMessage(playerid, COLOR_GREY, "[Farmer Job]:Tot lam! Ban con 23 checkpoint can phai hoan thanh nua.");
		SetPlayerCheckpoint(playerid, -286.6838,-1366.6523,9.2448, 10);
	}
	if(IsPlayerInRangeOfPoint(playerid, 10, -286.6838,-1366.6523,9.2448) && GetVehicleModel(GetPlayerVehicleID(playerid)) == 532)
 	{
 		DisablePlayerCheckpoint(playerid);
		SendClientMessage(playerid, COLOR_GREY, "[Farmer Job]:Tot lam! Ban con 22 checkpoint can phai hoan thanh nua.");
		SetPlayerCheckpoint(playerid, -299.1016,-1345.1233,7.8737, 10);
	}
	if(IsPlayerInRangeOfPoint(playerid, 10, -299.1016,-1345.1233,7.8737) && GetVehicleModel(GetPlayerVehicleID(playerid)) == 532)
 	{
 		DisablePlayerCheckpoint(playerid);
		SendClientMessage(playerid, COLOR_GREY, "[Farmer Job]:Tot lam! Ban con 21 checkpoint can phai hoan thanh nua.");
		SetPlayerCheckpoint(playerid, -285.5391,-1314.0519,9.4996, 10);
	}
	if(IsPlayerInRangeOfPoint(playerid, 10, -285.5391,-1314.0519,9.4996) && GetVehicleModel(GetPlayerVehicleID(playerid)) == 532)
 	{
 		DisablePlayerCheckpoint(playerid);
		SendClientMessage(playerid, COLOR_GREY, "[Farmer Job]:Tot lam! Ban con 20 checkpoint can phai hoan thanh nua.");
		SetPlayerCheckpoint(playerid, -263.7585,-1322.7645,9.2727, 10);
	}
	if(IsPlayerInRangeOfPoint(playerid, 10, -263.7585,-1322.7645,9.2727) && GetVehicleModel(GetPlayerVehicleID(playerid)) == 532)
 	{
 		DisablePlayerCheckpoint(playerid);
		SendClientMessage(playerid, COLOR_GREY, "[Farmer Job]:Tot lam! Ban con 19 checkpoint can phai hoan thanh nua.");
		SetPlayerCheckpoint(playerid, -247.7353,-1312.8854,10.7708, 10);
	}
	if(IsPlayerInRangeOfPoint(playerid, 10, -247.7353,-1312.8854,10.7708) && GetVehicleModel(GetPlayerVehicleID(playerid)) == 532)
 	{
 		DisablePlayerCheckpoint(playerid);
		SendClientMessage(playerid, COLOR_GREY, "[Farmer Job]:Tot lam! Ban con 18 checkpoint can phai hoan thanh nua.");
		SetPlayerCheckpoint(playerid, -230.6390,-1326.7452,10.5278, 10);
	}
	if(IsPlayerInRangeOfPoint(playerid, 10, -230.6390,-1326.7452,10.5278) && GetVehicleModel(GetPlayerVehicleID(playerid)) == 532)
 	{
 		DisablePlayerCheckpoint(playerid);
		SendClientMessage(playerid, COLOR_GREY, "[Farmer Job]:Tot lam! Ban con 17 checkpoint can phai hoan thanh nua.");
		SetPlayerCheckpoint(playerid, -208.9200,-1312.6355,8.0123, 10);
	}
	if(IsPlayerInRangeOfPoint(playerid, 10, -208.9200,-1312.6355,8.0123) && GetVehicleModel(GetPlayerVehicleID(playerid)) == 532)
 	{
 		DisablePlayerCheckpoint(playerid);
		SendClientMessage(playerid, COLOR_GREY, "[Farmer Job]:Tot lam! Ban con 16 checkpoint can phai hoan thanh nua.");
		SetPlayerCheckpoint(playerid, -184.9501,-1314.5737,6.7411, 10);
	}
	if(IsPlayerInRangeOfPoint(playerid, 10, -184.9501,-1314.5737,6.7411) && GetVehicleModel(GetPlayerVehicleID(playerid)) == 532)
 	{
 		DisablePlayerCheckpoint(playerid);
		SendClientMessage(playerid, COLOR_GREY, "[Farmer Job]:Tot lam! Ban con 15 checkpoint can phai hoan thanh nua.");
		SetPlayerCheckpoint(playerid, -165.0671,-1340.6115,3.1610, 10);
	}
	if(IsPlayerInRangeOfPoint(playerid, 10, -165.0671,-1340.6115,3.1610) && GetVehicleModel(GetPlayerVehicleID(playerid)) == 532)
 	{
 		DisablePlayerCheckpoint(playerid);
		SendClientMessage(playerid, COLOR_GREY, "[Farmer Job]:Tot lam! Ban con 14 checkpoint can phai hoan thanh nua.");
		SetPlayerCheckpoint(playerid, -182.6981,-1357.5033,4.1997, 10);
	}
	if(IsPlayerInRangeOfPoint(playerid, 10, -182.6981,-1357.5033,4.1997) && GetVehicleModel(GetPlayerVehicleID(playerid)) == 532)
 	{
 		DisablePlayerCheckpoint(playerid);
		SendClientMessage(playerid, COLOR_GREY, "[Farmer Job]:Tot lam! Ban con 13 checkpoint can phai hoan thanh nua.");
		SetPlayerCheckpoint(playerid, -166.5868,-1381.2855,3.2646, 10);
	}
	if(IsPlayerInRangeOfPoint(playerid, 10, -166.5868,-1381.2855,3.2646) && GetVehicleModel(GetPlayerVehicleID(playerid)) == 532)
 	{
 		DisablePlayerCheckpoint(playerid);
		SendClientMessage(playerid, COLOR_GREY, "[Farmer Job]:Tot lam! Ban con 12 checkpoint can phai hoan thanh nua.");
		SetPlayerCheckpoint(playerid, -169.7452,-1395.7577,3.3153, 10);
	}
	if(IsPlayerInRangeOfPoint(playerid, 10, -169.7452,-1395.7577,3.3153) && GetVehicleModel(GetPlayerVehicleID(playerid)) == 532)
 	{
 		DisablePlayerCheckpoint(playerid);
		SendClientMessage(playerid, COLOR_GREY, "[Farmer Job]:Tot lam! Ban con 11 checkpoint can phai hoan thanh nua.");
		SetPlayerCheckpoint(playerid, -162.0952,-1412.2350,3.0394, 10);
	}
	if(IsPlayerInRangeOfPoint(playerid, 10, -162.0952,-1412.2350,3.0394) && GetVehicleModel(GetPlayerVehicleID(playerid)) == 532)
 	{
 		DisablePlayerCheckpoint(playerid);
		SendClientMessage(playerid, COLOR_GREY, "[Farmer Job]:Tot lam! Ban con 10 checkpoint can phai hoan thanh nua.");
		SetPlayerCheckpoint(playerid, -192.4460,-1407.2355,3.9017, 10);
	}
	if(IsPlayerInRangeOfPoint(playerid, 10, -192.4460,-1407.2355,3.9017) && GetVehicleModel(GetPlayerVehicleID(playerid)) == 532)
 	{
 		DisablePlayerCheckpoint(playerid);
		SendClientMessage(playerid, COLOR_GREY, "[Farmer Job]:Tot lam! Ban con 9 checkpoint can phai hoan thanh nua.");
		SetPlayerCheckpoint(playerid, -207.5008,-1421.8888,3.2155, 10);
	}
	if(IsPlayerInRangeOfPoint(playerid, 10, -207.5008,-1421.8888,3.2155) && GetVehicleModel(GetPlayerVehicleID(playerid)) == 532)
 	{
 		DisablePlayerCheckpoint(playerid);
		SendClientMessage(playerid, COLOR_GREY, "[Farmer Job]:Tot lam! Ban con 8 checkpoint can phai hoan thanh nua.");
		SetPlayerCheckpoint(playerid, -226.2545,-1411.9092,6.5599, 10);
	}
	if(IsPlayerInRangeOfPoint(playerid, 10, -226.2545,-1411.9092,6.5599) && GetVehicleModel(GetPlayerVehicleID(playerid)) == 532)
 	{
 		DisablePlayerCheckpoint(playerid);
		SendClientMessage(playerid, COLOR_GREY, "[Farmer Job]:Tot lam! Ban con 7 checkpoint can phai hoan thanh nua.");
		SetPlayerCheckpoint(playerid, -247.6317,-1427.6404,6.6805, 10);
	}
	if(IsPlayerInRangeOfPoint(playerid, 10, -247.6317,-1427.6404,6.6805) && GetVehicleModel(GetPlayerVehicleID(playerid)) == 532)
 	{
 		DisablePlayerCheckpoint(playerid);
		SendClientMessage(playerid, COLOR_GREY, "[Farmer Job]:Tot lam! Ban con 6 checkpoint can phai hoan thanh nua.");
		SetPlayerCheckpoint(playerid, -263.1941,-1420.1913,9.3854, 10);
	}
	if(IsPlayerInRangeOfPoint(playerid, 10, -263.1941,-1420.1913,9.3854) && GetVehicleModel(GetPlayerVehicleID(playerid)) == 532)
 	{
 		DisablePlayerCheckpoint(playerid);
		SendClientMessage(playerid, COLOR_GREY, "[Farmer Job]:Tot lam! Ban con 5 checkpoint can phai hoan thanh nua.");
		SetPlayerCheckpoint(playerid, -284.1987,-1431.4486,12.0138, 10);
	}
	if(IsPlayerInRangeOfPoint(playerid, 10, -284.1987,-1431.4486,12.0138) && GetVehicleModel(GetPlayerVehicleID(playerid)) == 532)
 	{
 		DisablePlayerCheckpoint(playerid);
		SendClientMessage(playerid, COLOR_GREY, "[Farmer Job]:Tot lam! Ban con 4 checkpoint can phai hoan thanh nua.");
		SetPlayerCheckpoint(playerid, -300.6557,-1424.9337,14.0705, 10);
	}
	if(IsPlayerInRangeOfPoint(playerid, 10, -300.6557,-1424.9337,14.0705) && GetVehicleModel(GetPlayerVehicleID(playerid)) == 532)
 	{
 		DisablePlayerCheckpoint(playerid);
		SendClientMessage(playerid, COLOR_GREY, "[Farmer Job]:Tot lam! Ban con 3 checkpoint can phai hoan thanh nua.");
		SetPlayerCheckpoint(playerid, -320.6297,-1431.7501,15.1514, 10);
	}
	if(IsPlayerInRangeOfPoint(playerid, 10, -320.6297,-1431.7501,15.1514) && GetVehicleModel(GetPlayerVehicleID(playerid)) == 532)
 	{
 		DisablePlayerCheckpoint(playerid);
		SendClientMessage(playerid, COLOR_GREY, "[Farmer Job]:Tot lam! Ban con 2 checkpoint can phai hoan thanh nua.");
		SetPlayerCheckpoint(playerid, -330.9842,-1410.7192,14.1269, 10);
	}
	if(IsPlayerInRangeOfPoint(playerid, 10, -330.9842,-1410.7192,14.1269) && GetVehicleModel(GetPlayerVehicleID(playerid)) == 532)
 	{
 		DisablePlayerCheckpoint(playerid);
		SendClientMessage(playerid, COLOR_GREY, "[Farmer Job]:Tot lam! Ban con 1 checkpoint can phai hoan thanh nua.");
		SetPlayerCheckpoint(playerid, -343.0883,-1369.3920,14.4816, 10);
	}
	if(IsPlayerInRangeOfPoint(playerid, 10, -343.0883,-1369.3920,14.4816) && GetVehicleModel(GetPlayerVehicleID(playerid)) == 532)
 	{
 	    new vehicleid = GetPlayerVehicleID(playerid);
 		DisablePlayerCheckpoint(playerid);
		SendClientMessage(playerid, COLOR_GREY, "[Farmer Job]:Tot lam Farmer! You finished the harvesting. Here is your reward.");
		SendClientMessage(playerid, COLOR_PURPLE,"[Farmer Job]:You gained 13000$ from harvesting.");
		PlayerPlaySound(playerid, 1058, 0.0, 0.0, 0.0);
		SetVehicleToRespawn(vehicleid);
		GivePlayerCash(playerid, 13000);//Tiengatlua
		gPlayerCheckpointStatus[playerid] = CHECKPOINT_NONE;
	}
	//===VAN CHUYEN NONG SAN===//
	new vehicleidz = GetPlayerVehicleID(playerid);
	if(IsAFarverCar(vehicleidz) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER && GetVehicleModel(vehicleidz) == 478)
	{
	if(IsPlayerInRangeOfPoint(playerid, 10, -335.1576,-1030.4205,59.1934))
 	{

 		DisablePlayerCheckpoint(playerid);
		SendClientMessage(playerid, COLOR_GREY, "[Farmer Job]:Tot lam! Ban con 4 checkpoint can phai hoan thanh nua.");
		SetPlayerCheckpoint(playerid, -1111.2207,-1619.7231,76.3672, 10);
	}
	if(IsPlayerInRangeOfPoint(playerid, 10, -1111.2207,-1619.7231,76.367))
 	{
 		DisablePlayerCheckpoint(playerid);
		SendClientMessage(playerid, COLOR_GREY, "[Farmer Job]:Tot lam! Ban con 3 checkpoint can phai hoan thanh nua.");
		SetPlayerCheckpoint(playerid, -414.3708,-1754.7161,6.4640, 10);
	}
	if(IsPlayerInRangeOfPoint(playerid, 10, -414.3708,-1754.7161,6.4640))
 	{
 		DisablePlayerCheckpoint(playerid);
		SendClientMessage(playerid, COLOR_GREY, "[Farmer Job]:Tot lam! Ban con 2 checkpoint can phai hoan thanh nua.");
		SetPlayerCheckpoint(playerid, -579.6287,-1468.8931,10.5009, 10);
	}
	if(IsPlayerInRangeOfPoint(playerid, 10, -579.6287,-1468.8931,10.5009))
 	{
 		DisablePlayerCheckpoint(playerid);
		SendClientMessage(playerid, COLOR_GREY, "[Farmer Job]:Tot lam! Ban con 1 checkpoint can phai hoan thanh nua.");
		SetPlayerCheckpoint(playerid, -382.5363,-1426.1783,26.2084, 10);

	}
	if(IsPlayerInRangeOfPoint(playerid, 10, -382.5363,-1426.1783,26.2084) && GetPVarInt(playerid,"VanChuyen") == 1)
 	{
 	    new vehicleid = GetPlayerVehicleID(playerid);
 		DisablePlayerCheckpoint(playerid);
		SendClientMessage(playerid, COLOR_GREY, "[Farmer Job]:Tot lam! Ban da hoan thanh cong viec va se nhan duoc tien.");
		SendClientMessage(playerid, COLOR_PURPLE,"[Farmer Job]:Ban nhan duoc 25000$ tu viec van chuyen nong san.");
		PlayerPlaySound(playerid, 1058, 0.0, 0.0, 0.0);
		SetVehicleToRespawn(vehicleid);
		GivePlayerCash(playerid, 30000);//tienvanchuyennongsan
		gPlayerCheckpointStatus[playerid] = CHECKPOINT_NONE;
		SetPVarInt(playerid,"VanChuyen",0);
	}
	}
    if(GetPVarInt(playerid, "EventToken") == 1)
	{
	    if(EventKernel[EventFootRace] == 1 && IsPlayerInAnyVehicle(playerid))
	    {
			return SendClientMessageEx(playerid, COLOR_WHITE, "You cannot be inside vehicles and participate in this event at the same time.");
	    }
	    if(EventRCPT[RCPIdCurrent[playerid]] == 3 && PlayerInfo[playerid][pHydration] < 60) {
		    SendClientMessageEx(playerid, COLOR_WHITE, "You have entered a Watering Station checkpoint, you need to stay here in order to get rehydrated again.");
		    SendClientMessageEx(playerid, COLOR_WHITE, "You may choose to leave at any point or wait until you get the message of fully rehydrated.");
            SetPVarInt(playerid, "WSRCPTimerId", SetTimerEx("WateringStation", 4000, 1, "i", playerid));
            SetPVarInt(playerid, "InWaterStationRCP", 1);
            return 1;
		}
	    else if(EventRCPT[RCPIdCurrent[playerid]] == 4) {
			RCPIdCurrent[playerid] = 0;
			PlayerInfo[playerid][pHydration] -= 4;
			PlayerInfo[playerid][pRacePlayerLaps]++;
			if(PlayerInfo[playerid][pRacePlayerLaps] % 10 == 0) {
			    GiftPlayer(MAX_PLAYERS, playerid);
			}
			else if(PlayerInfo[playerid][pRacePlayerLaps] == 25) {
			    PlayerInfo[playerid][pEXPToken]++;
			    SendClientMessageEx(playerid, COLOR_YELLOW, "You have been given a Double EXP Token for completing 25 laps");
			}
			if(toglapcount == 0 && rflstatus > 0) {
				RaceTotalLaps++;
				Misc_Save();
				new query[128];
				if(PlayerInfo[playerid][pRFLTeam] != -1) {
					RFLInfo[PlayerInfo[playerid][pRFLTeam]][RFLlaps] +=1;
					format(query, sizeof(query), "UPDATE `rflteams` SET `laps` = %d WHERE `id` = %d;",
					RFLInfo[PlayerInfo[playerid][pRFLTeam]][RFLlaps],
					RFLInfo[PlayerInfo[playerid][pRFLTeam]][RFLsqlid]);
					mysql_function_query(MainPipeline, query, false, "OnQueryFinish", "i", SENDDATA_THREAD);
				}
				format(query, sizeof(query), "UPDATE `accounts` SET `RacePlayerLaps` = %d WHERE `id` = %d;", PlayerInfo[playerid][pRacePlayerLaps], GetPlayerSQLId(playerid));
				mysql_function_query(MainPipeline, query, false, "OnQueryFinish", "i", SENDDATA_THREAD);
			}
			new string[128];
			if(PlayerInfo[playerid][pRFLTeam] != -1) {
				format(string, sizeof(string), "Lap successfully completed. Laps Completed: %d | Team Laps Completed: %d | Total Laps Completed: %d", PlayerInfo[playerid][pRacePlayerLaps], RFLInfo[PlayerInfo[playerid][pRFLTeam]][RFLlaps], RaceTotalLaps);
			}
			else {
				format(string, sizeof(string), "Lap successfully completed. Laps Completed: %d | Total Laps Completed: %d", PlayerInfo[playerid][pRacePlayerLaps], RaceTotalLaps);
			}
			SendClientMessageEx(playerid, COLOR_WHITE, string);
		}
	    else
		{
	    	RCPIdCurrent[playerid]++;
            PlayerInfo[playerid][pHydration] -= 4;
		}
		new string[128];
        if(PlayerInfo[playerid][pHydration] > 60)
        {
			format(string, sizeof(string), "Hydration level normal(%d)", PlayerInfo[playerid][pHydration]);
			SendClientMessageEx(playerid, COLOR_GREEN, string);
		}
		else if(PlayerInfo[playerid][pHydration] < 61 && PlayerInfo[playerid][pHydration] > 30)
		{
		    format(string, sizeof(string), "Hydration level low(%d)", PlayerInfo[playerid][pHydration]);
			SendClientMessageEx(playerid, COLOR_YELLOW, string);
		}
		else if(PlayerInfo[playerid][pHydration] < 31 && PlayerInfo[playerid][pHydration] > 0)
		{
		    format(string, sizeof(string), "Hydration level very low(%d)", PlayerInfo[playerid][pHydration]);
			SendClientMessageEx(playerid, COLOR_RED, string);
		}
		else if(PlayerInfo[playerid][pHydration] < 0)
		{
		    SendClientMessageEx(playerid, COLOR_WHITE, "Ban da bi dua vao tram cap cuu, FDSA se cuu ban va dua vao tram cap cuu gan nhat.");
            DeletePVar(playerid, "EventToken");
			DisablePlayerCheckpoint(playerid);
			PlayerInfo[playerid][pHydration] = 100;
			if(IsValidDynamic3DTextLabel(RFLTeamN3D[playerid])) {
				DestroyDynamic3DTextLabel(RFLTeamN3D[playerid]);
			}
			SetPlayerHp(playerid, 0);
			return 1;
		}
	    if(EventRCPT[RCPIdCurrent[playerid]] == 1) {
	        DisablePlayerCheckpoint(playerid);
			SetPlayerCheckpoint(playerid, EventRCPX[RCPIdCurrent[playerid]], EventRCPY[RCPIdCurrent[playerid]], EventRCPZ[RCPIdCurrent[playerid]], EventRCPS[RCPIdCurrent[playerid]]);
		}
		else if(EventRCPT[RCPIdCurrent[playerid]] == 4) {
		    DisablePlayerCheckpoint(playerid);
		    SetPlayerCheckpoint(playerid, EventRCPX[RCPIdCurrent[playerid]], EventRCPY[RCPIdCurrent[playerid]], EventRCPZ[RCPIdCurrent[playerid]], EventRCPS[RCPIdCurrent[playerid]]);
		} else {
		    DisablePlayerCheckpoint(playerid);
		    SetPlayerCheckpoint(playerid, EventRCPX[RCPIdCurrent[playerid]], EventRCPY[RCPIdCurrent[playerid]], EventRCPZ[RCPIdCurrent[playerid]], EventRCPS[RCPIdCurrent[playerid]]);
		}
		return 1;
	}
	if(CP[playerid] == 252002)
 	{
	 	CP[playerid] = 0;
	 	PlayerPlaySound(playerid, 1056, 0.0, 0.0, 0.0);
	 	PlayerInfo[playerid][pCash] += 75000;
	 	PlayerInfo[playerid][pCigar] += 1;
	 	PlayerInfo[playerid][pTokens] += 2;
	    SendClientMessage(playerid, COLOR_WHITE, " Ban da tron thoat thanh cong!");
	    SendClientMessage(playerid, COLOR_WHITE, " Ban nhan duoc 75000$ + mot dieu xi ga va 2 token VIP!");
	 	DisablePlayerCheckpoint(playerid);
 	}
 	if(GetPVarInt(playerid,"nhantien") != 0)
	{
		if(PlayerInfo[playerid][Robbing] == 1)
		{
		    if(RobStatus[RobberID1] == playerid)
			{
			    RobStatus[RobberID1] = 200;
			    if(RobStatus[RobberID1] > 199 && RobStatus[RobberID2] > 199 && RobStatus[RobberID3] > 199 && RobStatus[RobberID4] > 199 && RobStatus[RobberID5] > 199)
				{
				    RobStatus[BeingRobbed] = 0;
				    RobStatus[BankReload] = 2; // Can't be robbed for 2 hours
				    RobStatus[Setup] = 0;
				    FinishRobbery();
				}
			}
			if(RobStatus[RobberID2] == playerid)
			{
			    RobStatus[RobberID2] = 200;
			    if(RobStatus[RobberID1] > 199 && RobStatus[RobberID2] > 199 && RobStatus[RobberID3] > 199 && RobStatus[RobberID4] > 199 && RobStatus[RobberID5] > 199)
					{
					RobStatus[BeingRobbed] = 0;
					RobStatus[BankReload] = 2; // Can't be robbed for 2 hours
				    RobStatus[Setup] = 0;
				    FinishRobbery();
				}
			}
			if(RobStatus[RobberID3] == playerid)
			{
			    RobStatus[RobberID3] = 200;
			    if(RobStatus[RobberID1] > 199 && RobStatus[RobberID2] > 199 && RobStatus[RobberID3] > 199 && RobStatus[RobberID4] > 199 && RobStatus[RobberID5] > 199)
				{
				    RobStatus[BeingRobbed] = 0;
				    RobStatus[BankReload] = 2; // Can't be robbed for 2 hours
				    RobStatus[Setup] = 0;
				    FinishRobbery();
				}
			}
			if(RobStatus[RobberID4] == playerid)
			{
			    RobStatus[RobberID4] = 200;
			    if(RobStatus[RobberID1] > 199 && RobStatus[RobberID2] > 199 && RobStatus[RobberID3] > 199 && RobStatus[RobberID4] > 199 && RobStatus[RobberID5] > 199)
				{
				    RobStatus[BeingRobbed] = 0;
				    RobStatus[BankReload] = 2; // Can't be robbed for 2 hours
				    RobStatus[Setup] = 0;
				    FinishRobbery();
				}
			}
			if(RobStatus[RobberID5] == playerid)
			{
			    RobStatus[RobberID5] = 200;
			    if(RobStatus[RobberID1] > 199 && RobStatus[RobberID2] > 199 && RobStatus[RobberID3] > 199 && RobStatus[RobberID4] > 199 && RobStatus[RobberID5] > 199)
				{
				    RobStatus[BeingRobbed] = 0;
				    RobStatus[BankReload] = 2; // Can't be robbed for 2 hours
				    RobStatus[Setup] = 0;
				    FinishRobbery();
				}
			}
			new stringa[128];
			format(stringa,sizeof(stringa),"Ban da den dia diem an toan va nhan duoc $%d.",PlayerInfo[playerid][CashLoaded]);
			RemovePlayerAttachedObject(playerid, 3 );

			new string[128];
			format(string, sizeof(string), "** Vu cuop ngan hang da thanh cong, canh sat da khong the ngan can bon cuop, ngan hang ton that kha nhieu **");
			SendClientMessageToAllEx(COLOR_ORANGE, string);
			FinishRobbery();
			SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "Vu cuop da thanh cong, ban da tron thoat khoi canh sat");
			PlayerInfo[playerid][pCash] += PlayerInfo[playerid][CashLoaded];
			PlayerInfo[playerid][CashLoaded] = 0;
			PlayerInfo[playerid][Robbing] = 0;
			DisablePlayerCheckpoint(playerid);
			//o day
			RobStatus[Setup] = 0;
			RobStatus[BeingRobbed] = 0;
			DeletePVar(playerid, "nhantien");
			gPlayerCheckpointStatus[playerid] = CHECKPOINT_NONE;
		}
	}
	if(GetPVarInt(playerid,"IsInArena") >= 0)
	{
	    new arenaid = GetPVarInt(playerid, "IsInArena");
	    if(PaintBallArena[arenaid][pbGameType] == 4 || PaintBallArena[arenaid][pbGameType] == 5)
	    {
	        //SendAudioToPlayer(playerid, 23, 100);
	    }
	    return 1;
	}
	if(GetPVarInt(playerid, "ShopCheckpoint") != 0)
	{
	    PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
	    DisablePlayerCheckpoint(playerid);
		DeletePVar(playerid, "ShopCheckpoint");
		return 1;
	}
	if(GetPVarInt(playerid,"TrackCar") != 0)
	{
	    PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
	    DisablePlayerCheckpoint(playerid);
		DeletePVar(playerid, "TrackCar");
		return 1;
	}
	if(GetPVarInt(playerid,"DV_TrackCar") != 0)
	{
	    PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
	    DisablePlayerCheckpoint(playerid);
		DeletePVar(playerid, "DV_TrackCar");
		return 1;
	}
	if(GetPVarInt(playerid,"bpanic") != 0)
	{
	    PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
	    DisablePlayerCheckpoint(playerid);
		DeletePVar(playerid, "bpanic");
		return 1;
	}
	if(GetPVarInt(playerid,"igps") != 0)
	{
	    PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
	    DisablePlayerCheckpoint(playerid);
		DeletePVar(playerid, "igps");
		return 1;
	}
	for(new h = 0; h < MAX_POINTS; h++)
	{
		if(Points[h][Type] == 3 && GetPVarInt(playerid, "CrateDeliver") == 1 && IsPlayerInRangeOfPoint(playerid, 6.0, 2166.3772,-1675.3829,15.0859))
		{
			new string[128];
		    if(GetPVarInt(playerid, "tpDrugRunTimer") != 0)
	    	{
			   	format(string, sizeof(string), "{AA3333}CanhBao{FFFF00}: %s (ID %d) nghi van hack tele.", GetPlayerNameEx(playerid), playerid);
		   		Kick(playerid);
			   	ABroadCast( COLOR_YELLOW, string, 2 );
			   	// format(string, sizeof(string), "%s (ID %d) co the dang hack tele drugrunning.", GetPlayerNameEx(playerid), playerid);
			   	// /*Log("logs/hack.log", string);*/
			}
			DisablePlayerCheckpoint(playerid);
			new level = PlayerInfo[playerid][pSmugSkill];
   			if(level >= 0 && level <= 20)
			{
			    SendClientMessageEx(playerid, COLOR_LIGHTBLUE,"* Ban da nhan duoc $12500 vi da van chuyen Ma tuy.");
				GivePlayerCash(playerid, 10000);
			}
			else if(level >= 21 && level <= 50)
			{
			    SendClientMessageEx(playerid, COLOR_LIGHTBLUE,"* Ban da nhan duoc $15000 vi da van chuyen Ma tuy.");
				GivePlayerCash(playerid, 13000);
			}
			else if(level >= 51 && level <= 100)
			{
			    SendClientMessageEx(playerid, COLOR_LIGHTBLUE,"* Ban da nhan duoc $20000 vi da van chuyen Ma tuy.");
				GivePlayerCash(playerid, 18000);
			}
			else if(level >= 101 && level <= 200)
			{
			    SendClientMessageEx(playerid, COLOR_LIGHTBLUE,"* Ban da nhan duoc $30000 vi da van chuyen Ma tuy.");
				GivePlayerCash(playerid, 28000);
			}
			else if(level >= 201)
			{
			    SendClientMessageEx(playerid, COLOR_LIGHTBLUE,"* Ban da nhan duoc $40000 vi da van chuyen Ma tuy.");
				GivePlayerCash(playerid, 30000);
			}
			DeletePVar(playerid, "CrateDeliver");
			PlayerInfo[playerid][pCrates] = 0;
			Points[h][Stock] += 10;

			if(DoubleXP) {
				SendClientMessageEx(playerid, COLOR_YELLOW, "Ban nhan duoc 1 diem ky nang smuggler thay vi 1. (Double XP kick hoat)");
				PlayerInfo[playerid][pSmugSkill] += 1;
			//	PlayerInfo[playerid][pXP] += PlayerInfo[playerid][pLevel] * XP_RATE * 2;
			}
			else
 			if(PlayerInfo[playerid][pDoubleEXP] > 0)
		    {
				format(string, sizeof(string), "Ban nhan duoc 2 diem ky nang smuggler thay vi 1. Ban co %d gio nua thi het han EXP nhan doi.", PlayerInfo[playerid][pDoubleEXP]);
				SendClientMessageEx(playerid, COLOR_YELLOW, string);
   				PlayerInfo[playerid][pSmugSkill] += 1;
			//	PlayerInfo[playerid][pXP] += PlayerInfo[playerid][pLevel] * XP_RATE * 2;
			}
			else
			{
  				PlayerInfo[playerid][pSmugSkill] += 1;
			}

			format(string, sizeof(string), " POT/OPIUM AVAILABLE: %d/1000.", Points[h][Stock]);
			UpdateDynamic3DTextLabelText(Points[h][TextLabel], COLOR_YELLOW, string);
			return 1;
		}
		else if(Points[h][Type] == 4 && GetPVarInt(playerid, "CrateDeliver") == 2 && IsPlayerInRangeOfPoint(playerid, 6.0, 2354.2808,-1169.2959,28.0066))
		{
			new string[128];
		    if(GetPVarInt(playerid, "tpDrugRunTimer") != 0)
	    	{
			   	format(string, sizeof(string), "{AA3333}CanhBao{FFFF00}: %s (ID %d) nghi van hack tele.", GetPlayerNameEx(playerid), playerid);
			   	Kick(playerid);
			   	ABroadCast( COLOR_YELLOW, string, 2 );
			   	// format(string, sizeof(string), "%s (ID %d) co the dang hack tele drugrunning.", GetPlayerNameEx(playerid), playerid);
			   	// /*Log("logs/hack.log", string);*/
			}
			DisablePlayerCheckpoint(playerid);
			new level = PlayerInfo[playerid][pSmugSkill];
			if(level >= 0 && level <= 20)
			{
			    SendClientMessageEx(playerid, COLOR_LIGHTBLUE,"* Ban da nhan duoc $12500 vi da van chuyen Ma tuy.");
				GivePlayerCash(playerid, 10000);
			}
			else if(level >= 21 && level <= 50)
			{
			    SendClientMessageEx(playerid, COLOR_LIGHTBLUE,"* Ban da nhan duoc $15000 vi da van chuyen Ma tuy.");
				GivePlayerCash(playerid, 13000);
			}
			else if(level >= 51 && level <= 100)
			{
			    SendClientMessageEx(playerid, COLOR_LIGHTBLUE,"* Ban da nhan duoc $20000 vi da van chuyen Ma tuy.");
				GivePlayerCash(playerid, 18000);
			}
			else if(level >= 101 && level <= 200)
			{
			    SendClientMessageEx(playerid, COLOR_LIGHTBLUE,"* Ban da nhan duoc $30000 vi da van chuyen Ma tuy.");
				GivePlayerCash(playerid, 25000);
			}
			else if(level >= 201)
			{
			    SendClientMessageEx(playerid, COLOR_LIGHTBLUE,"* Ban da nhan duoc $40000 vi da van chuyen Ma tuy.");
				GivePlayerCash(playerid, 30000);
			}
			DeletePVar(playerid, "CrateDeliver");
			PlayerInfo[playerid][pCrates] = 0;
			Points[h][Stock] += 10;
			PlayerInfo[playerid][pSmugSkill]++;
			format(string, sizeof(string), " CRACK AVAILABLE: %d/1000.", Points[h][Stock]);
			UpdateDynamic3DTextLabelText(Points[h][TextLabel], COLOR_YELLOW, string);
			return 1;
		}
		else if(Points[h][Type] == 2 && GetPVarInt(playerid, "MatDeliver") == Points[h][MatPoint] && IsPlayerInRangeOfPoint(playerid, 6.0, Points[h][Pointx], Points[h][Pointy], Points[h][Pointz]))
		{
			if(GetPVarInt(playerid, "Packages") > 0)
			{
				new string[128];
				if(GetPVarInt(playerid, "tpMatRunTimer") != 0)
			    {
			    	format(string, sizeof(string), "{AA3333}CanhBao{FFFF00}: %s (ID %d) nghi van hack tele.", GetPlayerNameEx(playerid), playerid);
			    	Kick(playerid);
			   		ABroadCast( COLOR_YELLOW, string, 2 );
			    	// format(string, sizeof(string), "%s (ID %d) co the dang hack tele matrunning.", GetPlayerNameEx(playerid), playerid);
			    	// /*Log("logs/hack.log", string);*/
				}
				new payout = (25)*(GetPVarInt(playerid, "Packages"));

				if(PlayerInfo[playerid][pDonateRank] == 1)
				{
					TransferStorage(playerid, -1, -1, -1, 4, 375, -1, 2);
					SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "* nha may cho ban 375 vat lieu vi da van chuyen 15 goi vat lieu.");
					SendClientMessageEx(playerid, COLOR_YELLOW,"Bronze VIP: Ban da nhan duoc 1.5x vat lieu vi quyen loi vip.");

				}
				else if(PlayerInfo[playerid][pDonateRank] == 2 || PlayerInfo[playerid][pDonateRank] == 3)
				{
				    TransferStorage(playerid, -1, -1, -1, 4, 500, -1, 2);
					SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "* nha may cho ban 500 vat lieu vi da van chuyen 20 goi vat lieu.");
					SendClientMessageEx(playerid, COLOR_YELLOW,"Silver & Gold VIP: Ban da nhan duoc 2x vat lieu vi quyen loi vip.");

				}
				else if(PlayerInfo[playerid][pDonateRank] >= 4)
				{
				    TransferStorage(playerid, -1, -1, -1, 4, 600, -1, 2);
					SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "* nha may cho ban 600 vat lieu vi da van chuyen 25 goi vat lieu.");
					SendClientMessageEx(playerid, COLOR_YELLOW,"Platinum VIP: Ban da nhan duoc 2.5x vat lieu vi quyen loi vip.");

				}
				else
				{
    				TransferStorage(playerid, -1, -1, -1, 4, 250, -1, 2);
					SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "* nha may cho ban 250 vat lieu vi da van chuyen 10 goi vat lieu.");
				}

				DeletePVar(playerid, "Packages");
				DeletePVar(playerid, "MatDeliver");
				DisablePlayerCheckpoint(playerid);

				for(new p = 0; p < sizeof(FamilyInfo); p++)
				{
					if(strcmp(Points[h][Owner], FamilyInfo[p][FamilyName], true) == 0)
					{
						FamilyInfo[p][FamilyBank] = FamilyInfo[p][FamilyBank]+(payout/3);
						//SendClientMessageEx(playerid, COLOR_WHITE, " Family owner recieved 50 percent of the cost.");
					}
				}
				return 1;
			}
		}
		else if(GetPVarInt(playerid, "MatDeliver") == 333 && IsPlayerInRangeOfPoint(playerid, 6.0, -1440.9235,1506.9829,-0.2292))
		{
			if(GetPVarInt(playerid, "Packages") > 0)
			{
				if(PlayerInfo[playerid][pDonateRank] == 1)
				{
   					TransferStorage(playerid, -1, -1, -1, 4, 675, -1, 2);
					SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "* nha may cho ban 375 vat lieu vi da van chuyen 23 goi vat lieu.");
					SendClientMessageEx(playerid, COLOR_YELLOW,"Bronze VIP: Ban da nhan duoc 1.5x vat lieu vi quyen loi vip.");
				}
				else if(PlayerInfo[playerid][pDonateRank] == 2 || PlayerInfo[playerid][pDonateRank] == 3)
				{
	   				TransferStorage(playerid, -1, -1, -1, 4, 900, -1, 2);
					 SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "* nha may cho ban 600 vat lieu vi da van chuyen 30 goi vat lieu.");
					SendClientMessageEx(playerid, COLOR_YELLOW,"Silver & Gold VIP: Ban da nhan duoc 2x vat lieu vi quyen loi vip.");
				}
				else if(PlayerInfo[playerid][pDonateRank] >= 4)
				{
					TransferStorage(playerid, -1, -1, -1, 4, 1125, -1, 2);
					SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "* nha may cho ban 900 vat lieu vi da van chuyen 38 goi vat lieu.");
					SendClientMessageEx(playerid, COLOR_YELLOW,"Platinum VIP: Ban da nhan duoc 2.5x vat lieu vi quyen loi vip.");
				}
				else
				{
					TransferStorage(playerid, -1, -1, -1, 4, 300, -1, 2);
					SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "* nha may cho ban 300 vat lieu vi da van chuyen 15 goi vat lieu.");
				}
				DeletePVar(playerid, "Packages");
				DeletePVar(playerid, "MatDeliver");
				DisablePlayerCheckpoint(playerid);
				if(GetPVarInt(playerid, "tpMatRunTimer") != 0)
			    {
					new string[128];
			    	format(string, sizeof(string), "{AA3333}CanhBao{FFFF00}: %s (ID %d) nghi van hack tele.", GetPlayerNameEx(playerid), playerid);
			    	Kick(playerid);
			   		ABroadCast( COLOR_YELLOW, string, 2 );
			    	// format(string, sizeof(string), "%s (ID %d) co the dang hack tele matrunning.", GetPlayerNameEx(playerid), playerid);
			    	// /*Log("logs/hack.log", string);*/
				}
				return 1;
			}
		}
		else if(GetPVarInt(playerid, "MatDeliver") == 444 && IsPlayerInRangeOfPoint(playerid, 6.0, -1872.879760, 1416.312500, 7.180089))
		{
			if(GetPVarInt(playerid, "Packages") > 0)
			{
				if(PlayerInfo[playerid][pDonateRank] == 1)
				{
				    TransferStorage(playerid, -1, -1, -1, 4, 675, -1, 2);
					SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "* nha may cho ban 375 vat lieu vi da van chuyen 18 goi vat lieu.");
					SendClientMessageEx(playerid, COLOR_YELLOW,"Bronze VIP: Ban da nhan duoc 1.5x vat lieu vi quyen loi vip.");

				}
				else if(PlayerInfo[playerid][pDonateRank] == 2 || PlayerInfo[playerid][pDonateRank] == 3)
				{
				    TransferStorage(playerid, -1, -1, -1, 4, 900, -1, 2);
					SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "* nha may cho ban 600 vat lieu vi da van chuyen 24 goi vat lieu.");
					SendClientMessageEx(playerid, COLOR_YELLOW,"Silver & Gold VIP: Ban da nhan duoc 2x vat lieu vi quyen loi vip.");

				}
				else if(PlayerInfo[playerid][pDonateRank] >= 4)
				{
				    TransferStorage(playerid, -1, -1, -1, 4, 1125, -1, 2);
					SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "* nha may cho ban 900 vat lieu vi da van chuyen 30 goi vat lieu.");
					SendClientMessageEx(playerid, COLOR_YELLOW,"Platinum VIP: Ban da nhan duoc 2.5x vat lieu vi quyen loi vip.");

				}
				else
				{
			    	TransferStorage(playerid, -1, -1, -1, 4, 300, -1, 2);
					SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "* nha may cho ban 300 vat lieu vi da van chuyen 12 goi vat lieu.");
				}

				DeletePVar(playerid, "Packages");
				DeletePVar(playerid, "MatDeliver");
				DisablePlayerCheckpoint(playerid);

				if(GetPVarInt(playerid, "tpMatRunTimer") != 0)
			    {
					new string[128];
			    	format(string, sizeof(string), "{AA3333}CanhBao{FFFF00}: %s (ID %d) nghi van hack tele.", GetPlayerNameEx(playerid), playerid);
                     Kick(playerid);
			   		ABroadCast( COLOR_YELLOW, string, 2 );
			    	// format(string, sizeof(string), "%s (ID %d) co the dang hack tele matrunning.", GetPlayerNameEx(playerid), playerid);
			    	// /*Log("logs/hack.log", string);*/
				}
				return 1;
			}
		}
		else if(GetPVarInt(playerid, "MatDeliver") == 500 && IsPlayerInRangeOfPoint(playerid, 6.0, 1679.39, 1749.96, 10.83))
		{
			if(GetPVarInt(playerid, "Packages") > 0)
			{
				if(PlayerInfo[playerid][pDonateRank] == 1)
				{
				    TransferStorage(playerid, -1, -1, -1, 4, 500, -1, 2);
					SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "* nha may cho ban 375 vat lieu vi da van chuyen 18 goi vat lieu.");
					SendClientMessageEx(playerid, COLOR_YELLOW,"Bronze VIP: Ban da nhan duoc 1.5x vat lieu vi quyen loi vip.");

				}
				else if(PlayerInfo[playerid][pDonateRank] == 2 || PlayerInfo[playerid][pDonateRank] == 3)
				{
				    TransferStorage(playerid, -1, -1, -1, 4, 300, -1, 2);
					SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "* nha may cho ban 600 vat lieu vi da van chuyen 24 goi vat lieu.");
					SendClientMessageEx(playerid, COLOR_YELLOW,"Silver & Gold VIP: Ban da nhan duoc 2x vat lieu vi quyen loi vip.");

				}
				else if(PlayerInfo[playerid][pDonateRank] >= 4)
				{
				    TransferStorage(playerid, -1, -1, -1, 4, 600, -1, 2);
					SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "* nha may cho ban 900 vat lieu vi da van chuyen 30 goi vat lieu.");
					SendClientMessageEx(playerid, COLOR_YELLOW,"Platinum VIP: Ban da nhan duoc 2.5x vat lieu vi quyen loi vip.");

				}
				else
				{
			    	TransferStorage(playerid, -1, -1, -1, 4, 300, -1, 2);
					SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "* nha may cho ban 300 vat lieu vi da van chuyen 12 goi vat lieu.");
				}

				DeletePVar(playerid, "Packages");
				DeletePVar(playerid, "MatDeliver");
				DisablePlayerCheckpoint(playerid);

				if(GetPVarInt(playerid, "tpMatRunTimer") != 0)
			    {
					new string[128];
			    	format(string, sizeof(string), "{AA3333}CanhBao{FFFF00}: %s (ID %d) nghi van hack tele.", GetPlayerNameEx(playerid), playerid);
       	            Kick(playerid);
			   		ABroadCast( COLOR_YELLOW, string, 2 );
			    	// format(string, sizeof(string), "%s (ID %d) co the dang hack tele matrunning.", GetPlayerNameEx(playerid), playerid);
			    	// /*Log("logs/hack.log", string);*/
				}
				return 1;
			}
		}
	}
	if(GetPVarInt(playerid, "TruckDeliver") > 0 && gPlayerCheckpointStatus[playerid] != CHECKPOINT_RETURNTRUCK)
	{
	    new vehicleid = GetPlayerVehicleID(playerid);
	    if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER)
	    {
	        SendClientMessageEx(playerid, COLOR_WHITE, "Ban khong o trong truck!");
	        return 1;
	    }
	    if(TruckUsed[playerid] != INVALID_VEHICLE_ID && vehicleid != TruckUsed[playerid])
	    {
	        SendClientMessageEx(playerid, COLOR_WHITE, "Day khong phai la xe truck cua ban!");
	        return 1;
	    }

		if(!IsAtTruckDeliveryPoint(playerid))
 		{// In the case the player finds a way to exploit the checkpoint to different location
			CancelTruckDelivery(playerid);
			SendClientMessageEx(playerid, COLOR_REALRED, "Loi: Sai dia diem, hang van chuyen se tu dong tu choi.");
			return 1;
   		}

		if(GetPVarInt(playerid, "tpTruckRunTimer") != 0)
		{
  			new string[128];
			format(string, sizeof(string), "{AA3333}CanhBao{FFFF00}: %s (ID %d) nghi van hack tele.", GetPlayerNameEx(playerid), playerid);
 			ABroadCast( COLOR_YELLOW, string, 2 );
 			Kick(playerid);
		}
		new truckdeliver = GetPVarInt(playerid, "TruckDeliver");
		TruckContents{vehicleid} = 0;

		if(truckdeliver == 1)
		{
			SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "* Ban da van chuyen food & beverages, quay ve noi xuat phat de nhan tien.");
		}
		else if(truckdeliver == 2)
		{
			SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "* Ban da van chuyen clothing, quay ve noi xuat phat de nhan tien.");
		}
		else if(truckdeliver == 3)
		{
			SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "* Ban da van chuyen materials, quay ve noi xuat phat de nhan tien.");
		}
		else if(truckdeliver == 4)
		{
			SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "* Ban da van chuyen 24/7 items, quay ve noi xuat phat de nhan tien.");
		}
		else if(truckdeliver == 5)
		{
			SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "* Ban da van chuyen weapons, quay ve noi xuat phat de nhan tien.");
		}
		else if(truckdeliver == 6)
		{
			SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "* Ban da van chuyen drugs, quay ve noi xuat phat de nhan tien.");
		}
		else if(truckdeliver == 7)
		{
			SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "* Ban da van chuyen illegal materials, quay ve noi xuat phat de nhan tien.");
		}
		DisablePlayerCheckpoint(playerid);

		gPlayerCheckpointStatus[playerid] = CHECKPOINT_RETURNTRUCK;
		if(IsABoat(vehicleid))
		{
			SetPlayerCheckpoint(playerid,2046.46,-60.74,-0.56, 5);
			GameTextForPlayer(playerid, "~w~Muc tieu ~r~San Fierro Docks", 5000, 1);
			SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "* Hay dua hang den dia diem tren ban do.");
		}
		else if(IsAHelicopter(vehicleid))
		{
	    	SetPlayerCheckpoint(playerid,-2116.29, -985.21, 32.17, 5);
	    	GameTextForPlayer(playerid, "~w~Muc tieu ~r~San Fierro Docks", 5000, 1);
			SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "* Hay dua hang den dia diem tren ban do.");
		}
		else if(IsAPlane(vehicleid))
		{
			SetPlayerCheckpoint(playerid,-1352.73, -206.65, 14.15, 5);
			GameTextForPlayer(playerid, "~w~Muc tieu ~r~San Fierro Docks", 5000, 1);
			SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "* Hay dua hang den dia diem tren ban do.");
		}
		else
	    {
			SetPlayerCheckpoint(playerid,-1546.5526,124.9458,3.5547, 5);
			GameTextForPlayer(playerid, "~w~Muc tieu ~r~San Fierro Docks", 5000, 1);
	   		SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "* Hay dua hang den dia diem tren ban do.");
		}
		SetPVarInt(playerid, "tpTruckRunTimer", 30);
		SetTimerEx("OtherTimerEx", 1000, false, "ii", playerid, TYPE_TPTRUCKRUNTIMER);
		return 1;
	}
	if(gPlayerCheckpointStatus[playerid] == CHECKPOINT_DELIVERY)
	{
	    new vehicleid = GetPlayerVehicleID(playerid);
	    if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER)
	    {
	        SendClientMessageEx(playerid, COLOR_WHITE, "Ban khong o trong xe truck!");
	        return 1;
	    }
	    if(TruckUsed[playerid] != INVALID_VEHICLE_ID && vehicleid != TruckUsed[playerid])
	    {
	        SendClientMessageEx(playerid, COLOR_WHITE, "Day la xe truck cua ban, ban phai giao hang den dia diem!");
	        return 1;
	    }

		new business = TruckDeliveringTo[vehicleid];

		if (!IsPlayerInRangeOfPoint(playerid, 20.0, Businesses[business][bSupplyPos][0], Businesses[business][bSupplyPos][1], Businesses[business][bSupplyPos][2])) return 1;

		if(GetPVarInt(playerid, "tpTruckRunTimer") != 0)
		{
  			new string[128];
			format(string, sizeof(string), "{AA3333}CanhBao{FFFF00}: %s (ID %d) nghi van hack tele.", GetPlayerNameEx(playerid), playerid);
			Kick(playerid);
 			ABroadCast( COLOR_YELLOW, string, 2 );
    		// format(string, sizeof(string), "%s (ID %d) co the dang hack tele truckrunning.", GetPlayerNameEx(playerid), playerid);
	    	// /*Log("logs/hack.log", string);*/
		}

		new string[128];
		format(string, sizeof(string), "* Ban da van chuyen %s den %s. Quay lai truck San Fierro Docks de nhan tien.", GetInventoryType(business), Businesses[business][bName]);
		SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);

		Businesses[business][bOrderState] = 3;
		Businesses[business][bInventory] += Businesses[business][bOrderAmount];
		foreach (new i: Player)
		{
			if (PlayerInfo[i][pBusiness] == business) SendClientMessageEx(i, COLOR_WHITE, "Don dat hang da duoc dua den ban.");
		}
		if (Businesses[business][bType] == BUSINESS_TYPE_GASSTATION)
		{
			for (new i; i < MAX_BUSINESS_GAS_PUMPS; i++)
			{
				Businesses[business][GasPumpGallons][i] = Businesses[business][GasPumpCapacity][i];
			}
		}
		SaveBusiness(business);
		DisablePlayerCheckpoint(playerid);

		gPlayerCheckpointStatus[playerid] = CHECKPOINT_RETURNTRUCK;
		SetPlayerCheckpoint(playerid, -1546.5526,124.9458,3.5547, 5);
		GameTextForPlayer(playerid, "~w~Waypoint set ~r~San Fierro Docks", 5000, 1);
		SendClientMessageEx(playerid, COLOR_WHITE, "HINT: quay tro ve San Fierro Docks (Xem o tren mini MAP).");
		return 1;
	}
	if(GetPVarInt(playerid, "Pizza") > 0 && IsPlayerInRangeOfPoint(playerid, 5.0, HouseInfo[GetPVarInt(playerid, "Pizza")][hExteriorX], HouseInfo[GetPVarInt(playerid, "Pizza")][hExteriorY], HouseInfo[GetPVarInt(playerid, "Pizza")][hExteriorZ]) && GetPlayerInterior(playerid) == HouseInfo[GetPVarInt(playerid, "Pizza")][hExtIW] && GetPlayerVirtualWorld(playerid) == HouseInfo[GetPVarInt(playerid, "Pizza")][hExtVW])
	{
	    new string[128];
		if (GetPVarInt(playerid, "tpPizzaTimer") != 0)
		{
			format(string, sizeof(string), "{AA3333}CanhBao{FFFF00}: %s (ID %d) nghi van hack tele.", GetPlayerNameEx(playerid), playerid);
			Kick(playerid);
 			ABroadCast( COLOR_YELLOW, string, 2 );
		}
		format(string, sizeof(string), "Ban da dua pizza dung gio, ban nhan duoc $%d.", (GetPVarInt(playerid, "pizzaTimer") * 150));
		Misc_Save();
		GivePlayerCash(playerid, floatround((GetPVarInt(playerid, "pizzaTimer") * 150), floatround_round));
		SendClientMessageEx(playerid, COLOR_WHITE, string);
		DeletePVar(playerid, "Pizza");
		DisablePlayerCheckpoint(playerid);

	}
	if(GetPVarInt(playerid, "Finding")>=1)
	{
	    DeletePVar(playerid, "Finding");
	    DisablePlayerCheckpoint(playerid);
	    GameTextForPlayer(playerid, "~w~Den noi", 5000, 1);
	}
	if(TaxiCallTime[playerid] > 0 && TaxiAccepted[playerid] != INVALID_PLAYER_ID)
	{
		TaxiAccepted[playerid] = INVALID_PLAYER_ID;
		GameTextForPlayer(playerid, "~w~Den noi", 5000, 1);
		TaxiCallTime[playerid] = 0;
		DisablePlayerCheckpoint(playerid);
	}
	else if(EMSCallTime[playerid] > 0 && EMSAccepted[playerid] != INVALID_PLAYER_ID)
	{
	    if(GetPVarInt(EMSAccepted[playerid], "Injured") == 1)
	    {
	    	SendEMSQueue(EMSAccepted[playerid],2);
	    	EMSAccepted[playerid] = INVALID_PLAYER_ID;
	    	GameTextForPlayer(playerid, "~w~Reached destination", 5000, 1);
	    	EMSCallTime[playerid] = 0;
	    	DisablePlayerCheckpoint(playerid);
		}
		else
		{
            EMSAccepted[playerid] = INVALID_PLAYER_ID;
		    GameTextForPlayer(playerid, "~r~Benh nhan da chet", 5000, 1);
		    EMSCallTime[playerid] = 0;
	    	DisablePlayerCheckpoint(playerid);
		}
	}
	else if(BusCallTime[playerid] > 0 && BusAccepted[playerid] != INVALID_PLAYER_ID)
	{
		BusAccepted[playerid] = INVALID_PLAYER_ID;
		GameTextForPlayer(playerid, "~w~Den noi", 5000, 1);
		BusCallTime[playerid] = 0;
		DisablePlayerCheckpoint(playerid);
	}
	else if(MedicCallTime[playerid] > 0 && MedicAccepted[playerid] != INVALID_PLAYER_ID)
	{
		MedicAccepted[playerid] = INVALID_PLAYER_ID;
		GameTextForPlayer(playerid, "~w~Den noi", 5000, 1);
		MedicCallTime[playerid] = 0;
		DisablePlayerCheckpoint(playerid);
	}
	else
	{
		switch (gPlayerCheckpointStatus[playerid])
		{
			case CHECKPOINT_HOME:
			{
				PlayerPlaySound(playerid, 1058, 0.0, 0.0, 0.0);
				new i = hInviteHouse[playerid];
				DisablePlayerCheckpoint(playerid);
				gPlayerCheckpointStatus[playerid] = CHECKPOINT_NONE;
				SetPlayerInterior(playerid,HouseInfo[i][hIntIW]);
				SetPlayerPos(playerid,HouseInfo[i][hInteriorX],HouseInfo[i][hInteriorY],HouseInfo[i][hInteriorZ]);
				GameTextForPlayer(playerid, "~w~Welcome Home", 5000, 1);
				PlayerInfo[playerid][pInt] = HouseInfo[i][hIntIW];
				PlayerInfo[playerid][pVW] = HouseInfo[i][hIntVW];
				SetPlayerVirtualWorld(playerid,HouseInfo[i][hIntVW]);
				if(HouseInfo[i][hCustomInterior] == 1) Player_StreamPrep(playerid, HouseInfo[i][hInteriorX],HouseInfo[i][hInteriorY],HouseInfo[i][hInteriorZ], FREEZE_TIME);
				hInviteOffer[playerid] = INVALID_PLAYER_ID;
				hInviteHouse[playerid] = INVALID_HOUSE_ID;
			}
   			case CHECKPOINT_LOADTRUCK:
			{
			    if(IsPlayerInRangeOfPoint(playerid, 6, -1697.7749,20.4529,3.5547) || IsPlayerInRangeOfPoint(playerid, 6, 2046.46,-60.74,-0.56) || IsPlayerInRangeOfPoint(playerid, 6, -1352.73, -206.65, 14.15) || IsPlayerInRangeOfPoint(playerid, 6, -2116.29, -985.21, 32.17))
			    {
				    new vehicleid = GetPlayerVehicleID(playerid);
	   				if(IsATruckerCar(vehicleid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
		    		{
				    	PlayerPlaySound(playerid, 1058, 0.0, 0.0, 0.0);
				    	DisablePlayerCheckpoint(playerid);
				    	gPlayerCheckpointStatus[playerid] = CHECKPOINT_NONE;
						TogglePlayerControllable(playerid, 0);
						SetPVarInt(playerid, "IsFrozen", 1);
						DisplayOrders(playerid);
					}
					else return SendClientMessageEx(playerid, COLOR_WHITE, "Day khong phai la xe cua trucker!");
				}
			}
			case CHECKPOINT_DONRAC:
			{
			     if(IsPlayerInRangeOfPoint(playerid, 5.0, HouseInfo[GetPVarInt(playerid, "NhaLayRac")][hTrasX], HouseInfo[GetPVarInt(playerid, "NhaLayRac")][hTrasY], HouseInfo[GetPVarInt(playerid, "NhaLayRac")][hTrasZ]))
			    {
			        if(GetPVarInt(playerid, "BatDauDonRac") == 1 || PlayerInfo[playerid][pJob] == 22 || PlayerInfo[playerid][pJob2] == 22)
					{
					    SetPVarInt(playerid, "DangGiuTuiRac", 1);
						SetPVarInt(playerid, "SoLuongTuiRac", 1);
						DisablePlayerCheckpoint(playerid);
						gPlayerCheckpointStatus[playerid] = CHECKPOINT_NONE;
     	                SetPlayerAttachedObjectEx(playerid, 0, 1265, 6, 0.217999, -0.071999, -0.056000, 3.199998, -81.099960, 62.800006, 0.537000, 0.528999, 0.835000, 0, 0);
						GameTextForPlayer(playerid, "Ban da nhat duoc mot ~b~goi rac!~n~~n~~w~Gio hay an nut ~b~Y~w~ de nem no vao thung xe", 3000, 3);
						PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
					}
					else return SendClientMessageEx(playerid, COLOR_GRAD1,"He Thong: Ban chua bat dau cong viec don rac");
			    }
				else return SendClientMessageEx(playerid, COLOR_GRAD1,"He Thong: Ban khong dung tai diem lay rac, hay di toi diem lay rac de tiep tuc cong viec");
			}
			case CHECKPOINT_RETURNTRUCK:
			{
			    if(!IsPlayerInRangeOfPoint(playerid, 6, -1546.5526,124.9458,3.5547) && !IsPlayerInRangeOfPoint(playerid, 6, 2046.46,-60.74,-0.56) && !IsPlayerInRangeOfPoint(playerid, 6, -1352.73, -206.65, 14.15) && !IsPlayerInRangeOfPoint(playerid, 6, -2116.29, -985.21, 32.17))
			    {
                    CancelTruckDelivery(playerid);
                    SendClientMessageEx(playerid, COLOR_REALRED, "Loi: Sai dia diem, da tu choi truck.");
					return 1;
			    }
 				if(GetPVarInt(playerid, "tpTruckRunTimer") != 0)
				{
  					new string[128];
					format(string, sizeof(string), "{AA3333}CanhBao{FFFF00}: %s (ID %d) nghi van hack tele.", GetPlayerNameEx(playerid), playerid);
					Kick(playerid);
			   		ABroadCast( COLOR_YELLOW, string, 2 );
				}
   				new vehicleid = GetPlayerVehicleID(playerid);
				if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER)
	    		{
	        		SendClientMessageEx(playerid, COLOR_WHITE, "Ban khong lai chiec xe cua trucker!");
	        		return 1;
	    		}
	    		if(TruckUsed[playerid] != INVALID_VEHICLE_ID && vehicleid != TruckUsed[playerid])
	    		{
	        		SendClientMessageEx(playerid, COLOR_WHITE, "Day khong phai xe cua ban, hay tim xe cua ban de lay tien!");
	        		return 1;
	    		}

			    PlayerPlaySound(playerid, 1058, 0.0, 0.0, 0.0);
			    DisablePlayerCheckpoint(playerid);
			    gPlayerCheckpointStatus[playerid] = CHECKPOINT_NONE;
				new route = TruckRoute[vehicleid];
   				new string[128], payment;
				new level = PlayerInfo[playerid][pTruckSkill];
			    if(level >= 0 && level <= 50) payment =7000;
				else if(level >= 51 && level <= 100) payment = 9000;
				else if(level >= 100 && level <= 200) payment = 12000;
				else if(level >= 201 && level <= 400) payment = 15000;
				else if(level >= 401 && level <= 500) payment = 18000;
				else if(level >= 501 && level <= 700) payment = 23000;
				else if(level >= 701 && level <= 900) payment = 25000;
				else if(level >= 901 && level <= 1000) payment = 28000;
				else if(level >= 1001 && level <= 1600) payment = 31000;
				else if(level >= 1601) payment = 40000;

                new Float:distancepay;
				if(IsABoat(vehicleid))
				{
				    distancepay = floatmul(GetDistance(2046.46,-60.74,-0.56, BoatDropoffs[route][PosX], BoatDropoffs[route][PosY], BoatDropoffs[route][PosZ]), 1.5);
				}
				else if(IsAHelicopter(vehicleid))
				{
				    distancepay = floatmul(GetDistance(-2116.29, -985.21, 32.17, HeliDropoffs[route][PosX], HeliDropoffs[route][PosY], HeliDropoffs[route][PosZ]), 1.5);
				}
				else if(IsAPlane(vehicleid))
				{
				    distancepay = floatmul(GetDistance(-1352.73, -206.65, 14.15, PlaneDropoffs[route][PosX], PlaneDropoffs[route][PosY], PlaneDropoffs[route][PosZ]), 1.5);
				}
				else
				{
				    distancepay = floatmul(GetDistance(-1546.5526,124.9458,3.5547, TruckerDropoffs[route][PosX], TruckerDropoffs[route][PosY], TruckerDropoffs[route][PosZ]), 1.5);
				}
				payment += floatround(distancepay);
				if(TruckDeliveringTo[vehicleid] != INVALID_BUSINESS_ID) {
					new iBusiness = TruckDeliveringTo[vehicleid];
			 		new Float: iDist = GetPlayerDistanceFromPoint(playerid, Businesses[iBusiness][bSupplyPos][0], Businesses[iBusiness][bSupplyPos][1], Businesses[iBusiness][bSupplyPos][2]);

				 	payment = floatround(iDist / 10 * payment);
					if (payment > 35000) payment = 35000;

					GivePlayerCash(playerid, payment);
					format(string, sizeof(string), "* ban nhan duoc $%d vi da van chuyen hang.", payment);

				    SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
				    SetVehicleToRespawn(vehicleid);
				}
				else {
				    DeletePVar(playerid, "LoadType");
				    new truckdeliver = GetPVarInt(playerid, "TruckDeliver");
					TruckContents{vehicleid} = 0;

					if(truckdeliver >= 1 && truckdeliver <= 5)
					{
						GivePlayerCash(playerid, payment);
						format(string, sizeof(string), "* ban nhan duoc $%d vi da van chuyen hang.", payment);
					}
					else if(truckdeliver >= 5 && truckdeliver <= 7)
					{
						GivePlayerCash(playerid, payment);
		    			format(string, sizeof(string), "* ban nhan duoc $%d vi da van chuyen hang.", payment);

					}
				    SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
						if(truckdeliver == 5) // Weapons
					{
						if(PlayerInfo[playerid][pConnectHours] >= 2 && PlayerInfo[playerid][pWRestricted] <= 0)
						{
							if(level >= 0 && level <= 50)
							{
								SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "* Ban nhan duoc vu khi vi da van chuyen hang.");
								SetPlayerValidWeapon(playerid, 5, 60000);
							}
							else if(level >= 51 && level <= 100)
							{
								SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "* Ban nhan duoc sung vi da van chuyen hang.");
								SetPlayerValidWeapon(playerid, 8, 60000);

							}
							else if(level >= 101 && level <= 200)
							{
								SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "* Ban nhan duoc sung vi da van chuyen hang.");
								SetPlayerValidWeapon(playerid, 22, 7);
							}
							else if(level >= 201 && level <= 400)
							{
								SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "* Ban nhan duoc sung vi da van chuyen hang.");
								SetPlayerValidWeapon(playerid, 25, 7);
							}
							else if(level >= 401 && level <= 500)
							{
								SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "* Ban nhan duoc sung vi da van chuyen hang.");
								SetPlayerValidWeapon(playerid, 29, 12);
							}
							else if(level >= 501 && level <= 700)
							{
								SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "* Ban nhan duoc sung vi da van chuyen hang.");
								SetPlayerValidWeapon(playerid, 33, 7);
							}
							else if(level >= 701 && level <= 900)
							{
								SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "* Ban nhan duoc sung vi da van chuyen hang.");
								SetPlayerValidWeapon(playerid, 28, 7);
							}
							else if(level >= 901 && level <= 1000)
							{
								SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "* Ban nhan duoc sung vi da van chuyen hang.");
								SetPlayerValidWeapon(playerid, 32, 7);
							}
							else if(level >= 901 && level <= 1600)
							{
								SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "* Ban nhan duoc sung vi da van chuyen hang.");
								SetPlayerValidWeapon(playerid, 24, 7);
							}
							else if(level >= 1401)
							{
								SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "* Ban nhan duoc sung vi da van chuyen hang.");
								SetPlayerValidWeapon(playerid, 30, 7);
							}
						}
						else
						{
							SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "* Ban khong nhan duoc sung vi bi han che 2gio choi.");
						}
					}
					if(truckdeliver == 6) // Drugs
					{

						if(level >= 0 && level <= 50)
						{
		                    SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "* Ban nhan duoc 10 pot & 5 crack va  vi da van chuyen hang .");
						    PlayerInfo[playerid][pPot] += 10;
						    PlayerInfo[playerid][pCrack] += 5;
						}
						else if(level >= 51 && level <= 100)
						{
		                    SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "* Ban nhan duoc 15 pot & 10 crack vi da van chuyen hang.");
					    	PlayerInfo[playerid][pPot] += 15;
					    	PlayerInfo[playerid][pCrack] += 10;
						}
						else if(level >= 101 && level <= 200)
						{
		                    SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "* Ban nhan duoc 60 pot & 30 crack  vi da van chuyen hang.");
					    	PlayerInfo[playerid][pPot] += 20;
					    	PlayerInfo[playerid][pCrack] += 15;
						}
						else if(level >= 201 && level <= 400)
						{
		                    SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "* Ban nhan duoc 30 pot & 20 crack vi da van chuyen hang.");
					  	  	PlayerInfo[playerid][pPot] += 30;
				  	  		PlayerInfo[playerid][pCrack] += 20;
						}
						else if(level >= 401 && level <= 500)
						{
		                    SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "* Ban nhan duoc 40 pot & 35 crack vi da van chuyen hang.");
					   	 	PlayerInfo[playerid][pPot] += 40;
					   	 	PlayerInfo[playerid][pCrack] += 35;
						}
						else if(level >= 501 && level <= 700)
						{
		                    SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "* Ban nhan duoc 45 pot & 40 crack vi da van chuyen hang.");
					   	 	PlayerInfo[playerid][pPot] += 45;
					   	 	PlayerInfo[playerid][pCrack] += 40;
						}
						else if(level >= 701 && level <= 900)
						{
		                    SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "* Ban nhan duoc 50 pot & 45 crack vi da van chuyen hang.");
					   	 	PlayerInfo[playerid][pPot] += 50;
					   	 	PlayerInfo[playerid][pCrack] += 45;
						}
						else if(level >= 901 && level <= 1000)
						{
		                    SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "* Ban nhan duoc 60 pot & 50 crack vi da van chuyen hang.");
					   	 	PlayerInfo[playerid][pPot] += 60;
					   	 	PlayerInfo[playerid][pCrack] += 50;
						}
						else if(level >= 1001 && level <= 1600)
						{
		                    SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "* Ban nhan duoc 65 pot & 55 crack vi da van chuyen hang.");
					   	 	PlayerInfo[playerid][pPot] += 65;
					   	 	PlayerInfo[playerid][pCrack] += 55;
						}
						else if(level >= 1601)
						{
		                    SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "* Ban nhan duoc 70 pot & 65 crack vi da van chuyen hang.");
					   	 	PlayerInfo[playerid][pPot] += 70;
					   	 	PlayerInfo[playerid][pCrack] += 65;
						}
					}
						if(truckdeliver == 7) // Illegal materials
					{
						if(level >= 0 && level <= 50)
						{
		                    SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "* Ban nhan duoc 50 Vat lieu vi da van chuyen hang.");
							PlayerInfo[playerid][pMats] += 50;
						}
						else if(level >= 51 && level <= 100)
						{
		                    SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "* Ban nhan duoc 100 Vat lieu vi da van chuyen hang.");
							PlayerInfo[playerid][pMats] += 100;
						}
						else if(level >= 101 && level <= 200)
						{
		                    SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "* Ban nhan duoc 150 Vat lieu vi da van chuyen hang.");
							PlayerInfo[playerid][pMats] += 150;
						}
						else if(level >= 201 && level <= 400)
						{
		                    SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "* Ban nhan duoc 200 Vat lieu vi da van chuyen hang.");
							PlayerInfo[playerid][pMats] += 200;
						}
						else if(level >= 401 && level <= 500)
						{
		                    SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "* Ban nhan duoc 250 Vat lieu  vi da van chuyen hang.");
							PlayerInfo[playerid][pMats] += 250;
						}
						else if(level >= 501 && level <= 700)
						{
		                    SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "* Ban nhan duoc 300 Vat lieu  vi da van chuyen hang.");
							PlayerInfo[playerid][pMats] += 300;
						}
						else if(level >= 701 && level <= 900)
						{
		                    SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "* Ban nhan duoc 350 Vat lieu  vi da van chuyen hang.");
							PlayerInfo[playerid][pMats] += 350;
						}
						else if(level >= 901 && level <= 1000)
						{
		                    SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "* Ban nhan duoc 400 Vat lieu  vi da van chuyen hang.");
							PlayerInfo[playerid][pMats] += 400;
						}
						else if(level >= 1001 && level <= 1600)
						{
		                    SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "* Ban nhan duoc 450 Vat lieu  vi da van chuyen hang.");
							PlayerInfo[playerid][pMats] += 450;
						}
						else if(level >= 1601)
						{
		                    SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "* Ban nhan duoc 550 Vat lieu  vi da van chuyen hang.");
							PlayerInfo[playerid][pMats] += 550;
						}
					}
				    SetVehicleToRespawn(vehicleid);
				}
					if(DoubleXP) {
					SendClientMessageEx(playerid, COLOR_YELLOW, "Ban da nhan duoc 2 truck diem ki nang thay vi 1. (Double XP Active)");
					PlayerInfo[playerid][pTruckSkill] += 2;
				}
				else
				if(PlayerInfo[playerid][pDoubleEXP] > 0 && !DoubleXP)
				{
					format(string, sizeof(string), "Ban da nhan duoc 1 truck diem ki nang thay vi 1. Ban con %d gio nua Double EXP token.", PlayerInfo[playerid][pDoubleEXP]);
					SendClientMessageEx(playerid, COLOR_YELLOW, string);
					PlayerInfo[playerid][pTruckSkill] += 2;
				}
				else
				{
					PlayerInfo[playerid][pTruckSkill] += 1;
				}

				TruckUsed[playerid] = INVALID_VEHICLE_ID;
				DeletePVar(playerid, "TruckDeliver");

				new mypoint = -1;
				for (new i=0; i<MAX_POINTS; i++)
				{
					if(strcmp(Points[i][Name], "San Fierro Docks", true) == 0)
					{
						mypoint = i;
					}
				}
				for(new i = 0; i < sizeof(FamilyInfo); i++)
				{
					if(strcmp(Points[mypoint][Owner], FamilyInfo[i][FamilyName], true) == 0)
					{
						Misc_Save();
						FamilyInfo[i][FamilyBank] = FamilyInfo[i][FamilyBank]+(200);
					}
			 	}
			}
			case CHECKPOINT_HITMAN:
			{
			    PlayerPlaySound(playerid, 1058, 0.0, 0.0, 0.0);
			    DisablePlayerCheckpoint(playerid);
			    gPlayerCheckpointStatus[playerid] = CHECKPOINT_NONE;
			    SendClientMessageEx(playerid, COLOR_GRAD2, "  /enter de vao trong HQ.");
			}
			case CHECKPOINT_HITMAN2:
			{
			    PlayerPlaySound(playerid, 1058, 0.0, 0.0, 0.0);
			    DisablePlayerCheckpoint(playerid);
			    gPlayerCheckpointStatus[playerid] = CHECKPOINT_NONE;
			    SendClientMessageEx(playerid, COLOR_GRAD2, "  /enter de vao trong HQ.");
			}
			case CHECKPOINT_HITMAN3:
			{
			    PlayerPlaySound(playerid, 1058, 0.0, 0.0, 0.0);
			    DisablePlayerCheckpoint(playerid);
			    gPlayerCheckpointStatus[playerid] = CHECKPOINT_NONE;
			    SendClientMessageEx(playerid, COLOR_GRAD2, "  /order de lay vu khi.");
			}
		}
	}
	if (GetPVarInt(playerid, "_SwimmingActivity") > 0)
	{
		new stage = GetPVarInt(playerid, "_SwimmingActivity");

		switch (stage)
		{
			case 1:
			{
				SetPlayerCheckpoint(playerid, 572.7506,-3184.1064,-0.7303, 2.0);
				SetPVarInt(playerid, "_SwimmingActivity", 2);
			}

			case 2:
			{
				SetPlayerCheckpoint(playerid, 568.3658,-3158.0996,-0.7071, 2.0);
				SetPVarInt(playerid, "_SwimmingActivity", 3);
			}

			case 3:
			{
				SetPlayerCheckpoint(playerid, 588.1848,-3158.7603,-0.4510, 2.0);
				SetPVarInt(playerid, "_SwimmingActivity", 4);
			}

			case 4:
			{
				SetPlayerCheckpoint(playerid, 584.5303,-3193.0017,-0.4139, 2.0);
				SetPVarInt(playerid, "_SwimmingActivity", 5);
			}

			case 5:
			{
				SetPlayerCheckpoint(playerid, 570.4682,-3192.0833,-0.6326, 2.0);
				SetPVarInt(playerid, "_SwimmingActivity", 6);
			}
			case 6:
			{
				SendClientMessageEx(playerid, COLOR_WHITE, "Lap completed! Your fitness has increased slightly.");
				if (PlayerInfo[playerid][pFitness] != 100) PlayerInfo[playerid][pFitness] += 3;
				SendClientMessageEx(playerid, COLOR_WHITE, "If you have finished exercising, type /stopswimming.");
				SetPVarInt(playerid, "_SwimmingActivity", 2);
				SetPlayerCheckpoint(playerid, 572.7506,-3184.1064,-0.7303, 2.0);
			}
		}
	}
	return 1;
}
skiplovebra is offline   Reply With Quote
Old 13/04/2016, 04:03 PM   #2
SyS
High-roller
 
SyS's Avatar
 
Join Date: Oct 2015
Posts: 1,939
Reputation: 504
Default Re: debug] Run time error 4: "Array index out of bounds"

Show the declaration of
PHP Code:
EventRCPT[RCPIdCurrent[playerid]] 
I think you doing wrong in there
SyS is offline   Reply With Quote
Old 13/04/2016, 04:16 PM   #3
Konstantinos
Spam Machine
 
Konstantinos's Avatar
 
Join Date: Dec 2011
Posts: 11,828
Reputation: 1401
Default Re: debug] Run time error 4: "Array index out of bounds"

The run time error is caused in a function with 1 only parameter which is playerid. There are a few functions so we can't just guess. Compile your script with debug info: https://github.com/Zeex/samp-plugin-...ith-debug-info
If the version of crashdetect is not 4.15.1, update it to the latest one.

After done the above, start the server, enter the checkpoint and try to reproduce it. If you get new logs, post them here.
__________________
Life is like riding a bicycle. To keep your balance, you must keep moving.

[Tutorial] How to use SQLite
[FilterScript] Tune System
Konstantinos is offline   Reply With Quote
Old 13/04/2016, 04:40 PM   #4
skiplovebra
Huge Clucker
 
Join Date: Sep 2015
Posts: 288
Reputation: 0
Default Re: debug] Run time error 4: "Array index out of bounds"

Quote:
Originally Posted by Konstantinos View Post
The run time error is caused in a function with 1 only parameter which is playerid. There are a few functions so we can't just guess. Compile your script with debug info: https://github.com/Zeex/samp-plugin-...ith-debug-info
If the version of crashdetect is not 4.15.1, update it to the latest one.

After done the above, start the server, enter the checkpoint and try to reproduce it. If you get new logs, post them here.
yes thanks bro
help please
http://forum.sa-mp.com/showthread.php?t=605042
skiplovebra is offline   Reply With Quote
Old 13/04/2016, 04:57 PM   #5
skiplovebra
Huge Clucker
 
Join Date: Sep 2015
Posts: 288
Reputation: 0
Default Re: debug] Run time error 4: "Array index out of bounds"

Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase

Header size: 45132 bytes
Code size: 7366620 bytes
Data size: 133011072 bytes
Stack/heap size: 18000000 bytes; estimated max. usage: unknown, due to recursion
Total requirements:158422824 bytes
skiplovebra is offline   Reply With Quote
Old 13/04/2016, 05:49 PM   #6
Sew_Sumi
Banned
 
Join Date: Jun 2008
Location: Azerbaijan
Posts: 6,243
Reputation: 525
Default Re: debug] Run time error 4: "Array index out of bounds"

Leaked script. No-one should be helping this guy at all.
Sew_Sumi is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[debug] Run time error 4: "Array index out of bounds" and many more errors :P ntmp Scripting Help 2 11/08/2014 02:10 PM
[debug] Run time error 4: "Array index out of bounds" gotwarzone Scripting Help 3 24/11/2013 03:59 PM
[debug] Run time error 4: "Array index out of bounds" Norrin Scripting Help 4 18/01/2013 10:42 AM
[debug] Run time error 4: "Array index out of bounds" rainsonb Scripting Help 1 20/12/2012 04:35 AM
[debug] Run time error 4: "Array index out of bounds" rati555 Scripting Help 2 29/08/2012 12:47 PM


All times are GMT. The time now is 01:00 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.