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



CrashDetech ? - nguyenquynh - 20.10.2013

Код:
[13:28:13] [debug] Run time error 4: "Array index out of bounds"
[13:28:13] [debug]  Accessing element at index 999 past array upper bound 499
[13:28:13] [debug] AMX backtrace:
[13:28:13] [debug] #0 000ac9e8 in ?? (0x00000001, 0x00000002, 0x00000001) from DFU_NGRP.amx
[13:28:13] [debug] #1 000148d8 in public OnPlayerStateChange (0x00000001, 0x00000002, 0x00000001) from DFU_NGRP.amx
Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate != 2) NOPTrigger[playerid] = 0;
	if(GettingSpectated[playerid] != INVALID_PLAYER_ID)
	{
	    new spectator = GettingSpectated[playerid];
	    if(!IsPlayerConnected(spectator))
	    {
	        GettingSpectated[playerid] = INVALID_PLAYER_ID;
	        Spectate[spectator] = INVALID_PLAYER_ID;
		}

	    if(newstate == PLAYER_STATE_DRIVER && PlayerInfo[spectator][pAdmin] >= 2 || newstate == PLAYER_STATE_PASSENGER && PlayerInfo[spectator][pAdmin] >= 2)
	    {
	        TogglePlayerSpectating(spectator, true);
			new carid = GetPlayerVehicleID( playerid );
			PlayerSpectateVehicle( spectator, carid );
	    }
	    else if(newstate == PLAYER_STATE_ONFOOT && PlayerInfo[spectator][pAdmin] >= 2)
	    {
	        TogglePlayerSpectating(spectator, true);
		   	PlayerSpectatePlayer( spectator, playerid );
		   	SetPlayerInterior( spectator, GetPlayerInterior( playerid ) );
	    }
	}
	if(newstate == PLAYER_STATE_ONFOOT)
	{
		StopAudioStreamForPlayerEx(playerid);
		if(GetPVarType(playerid, "Siren"))
		{
  			if(IsPlayerAttachedObjectSlotUsed(playerid, MAX_PLAYER_ATTACHED_OBJECTS - 2)) RemovePlayerAttachedObject(playerid, MAX_PLAYER_ATTACHED_OBJECTS - 2);
    		if(IsPlayerAttachedObjectSlotUsed(playerid, MAX_PLAYER_ATTACHED_OBJECTS - 1)) RemovePlayerAttachedObject(playerid, MAX_PLAYER_ATTACHED_OBJECTS - 1);
      		DeletePVar(playerid, "Siren");
		}

		if(GettingSpectated[playerid] < MAX_PLAYERS && PlayerInfo[GettingSpectated[playerid]][pAdmin] >= 2) {
			new spectator = GettingSpectated[playerid];
	        // Preventing possible buffer overflows with the arrays
	 		TogglePlayerSpectating(spectator, true);
			PlayerSpectatePlayer( spectator, playerid );
			SetPlayerInterior( spectator, GetPlayerInterior( playerid ) );
			SetPlayerInterior( spectator, GetPlayerInterior( playerid ) );
			SetPlayerVirtualWorld( spectator, GetPlayerVirtualWorld( playerid ) );
		}

	    if(oldstate == PLAYER_STATE_DRIVER)
		{
			SetPlayerWeaponsEx(playerid);
		}
		else if(oldstate == PLAYER_STATE_PASSENGER) SetPlayerWeaponsEx(playerid);

		if(ConnectedToPC[playerid] == 1337)//mdc
	    {
            SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "* Ban da thoat khoi MDC.");
	        ConnectedToPC[playerid] = 0;
		}
        if(TransportDuty[playerid] > 0)
		{
		    if(TransportDuty[playerid] == 1)
			{
		        TaxiDrivers -= 1;
			}
			else if(TransportDuty[playerid] == 2)
			{
			    BusDrivers -= 1;
			}
			TransportDuty[playerid] = 0;
			new string[42];
			format(string, sizeof(string), "* Ban dang ngoai gio lam viec va kiem duoc $%d.", TransportMoney[playerid]);
			SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
			GivePlayerCash(playerid, TransportMoney[playerid]);
			TransportValue[playerid] = 0; TransportMoney[playerid] = 0;
			if(PlayerInfo[playerid][pMember] != 10 && PlayerInfo[playerid][pLeader] != 10) { SetPlayerColor(playerid, TEAM_HIT_COLOR); }
			TransportTime[playerid] = 0;
   			TransportCost[playerid] = 0;
		}
		if(TransportDriver[playerid] < MAX_PLAYERS)
		{
			new string[128];
			TransportMoney[TransportDriver[playerid]] += TransportCost[playerid];
			format(string, sizeof(string), "~w~Chi phi di xe~n~~r~$%d",TransportCost[playerid]);
			GameTextForPlayer(playerid, string, 5000, 3);
			format(string, sizeof(string), "~w~Hanh khach roi khoi xe Taxi.~n~~g~Thu duoc $%d",TransportCost[playerid]);
			GameTextForPlayer(TransportDriver[playerid], string, 5000, 3);
			GivePlayerCash(playerid, -TransportCost[playerid]);

			if(TransportCost[playerid] >= 10000)
			{
				format(string, sizeof(string), "%s (IP:%s) tra tien %s (IP:%s) $%d trong dot nay.", GetPlayerNameEx(playerid), GetPlayerIpEx(playerid), GetPlayerNameEx(TransportDriver[playerid]), GetPlayerIpEx(TransportDriver[playerid]), TransportCost[playerid]);
				//Log("logs/pay.log", string);
				ABroadCast(COLOR_YELLOW, string, 2);
			}
			TransportTime[TransportDriver[playerid]] = 0;
			TransportCost[TransportDriver[playerid]] = 0;
			TransportCost[playerid] = 0;
			TransportTime[playerid] = 0;
			TransportDriver[playerid] = INVALID_PLAYER_ID;
		}
	}
    if(newstate == PLAYER_STATE_PASSENGER) // TAXI & BUSSES
	{
		fVehSpeed[playerid] = 0;
		fVehHealth[playerid] = 0;
 		if(!isnull(stationidv[GetPlayerVehicleID(playerid)]))
		{
   			PlayAudioStreamForPlayerEx(playerid, stationidv[GetPlayerVehicleID(playerid)]);
		}
        new vehicleid = GetPlayerVehicleID(playerid);
	    /*if(vehicleid == NGVehicles[12] ||
		vehicleid == NGVehicles[13] ||
		vehicleid == NGVehicles[14] ||
		vehicleid == NGVehicles[15] ||
		vehicleid == NGVehicles[16] ||
		vehicleid == NGVehicles[17])
		{
		    TogglePlayerSpectating(playerid, 1);
			PlayerSpectateVehicle(playerid, vehicleid);
			SetPVarInt(playerid, "NGPassenger", 1);
			SetPVarInt(playerid, "NGPassengerVeh", vehicleid);
			SetPVarInt(playerid, "NGPassengerSkin", GetPlayerSkin(playerid));
			new Float:health, Float:armour;
			GetPlayerHealth(playerid, health);
			GetPlayerArmour(playerid, armour);
			SetPVarFloat(playerid, "NGPassengerHP", health);
			SetPVarFloat(playerid, "NGPassengerArmor", armour);
		}*/

        if(PlayerInfo[playerid][pGuns][4] > 0)	SetPlayerArmedWeapon(playerid,PlayerInfo[playerid][pGuns][4]);
		else SetPlayerArmedWeapon(playerid,0);

	    gLastCar[playerid] = vehicleid;
	    foreach(new i: Player)
	    {
     		if(IsPlayerInVehicle(i, vehicleid) && GetPlayerState(i) == 2 && TransportDuty[i] > 0)
       		{
				if(GetPlayerCash(playerid) < TransportValue[i])
				{
					new string[28];
					format(string, sizeof(string), "* Ban can $%d de vao.", TransportValue[i]);
					SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
					RemovePlayerFromVehicle(playerid);
					new Float:X, Float:Y, Float:Z;
					GetPlayerPos(playerid, X, Y, Z);
					SetPlayerPos(playerid, X, Y, Z+2);
					TogglePlayerControllable(playerid, 1);
				}
				else
				{
					new string[35+MAX_PLAYER_NAME];
					if(TransportDuty[i] == 1)
					{
						format(string, sizeof(string), "* Ban tra tien $%d de viec di Taxi.", TransportValue[i]);
						SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
						format(string, sizeof(string), "* Hanh khach %s da vao Taxi.", GetPlayerNameEx(playerid));
						SendClientMessageEx(i, COLOR_LIGHTBLUE, string);
						TransportTime[i] = 1;
						TransportTime[playerid] = 1;
						TransportCost[playerid] = TransportValue[i];
						TransportCost[i] = TransportValue[i];
						TransportDriver[playerid] = i;
					}
					else if(TransportDuty[i] == 2)
					{
						format(string, sizeof(string), "* Ban tra tien $%d de viec di Taxi.", TransportValue[i]);
						SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
						format(string, sizeof(string), "* Hanh khach %s da vao Taxi.", GetPlayerNameEx(playerid));
						SendClientMessageEx(i, COLOR_LIGHTBLUE, string);
					}
					GivePlayerCash(playerid, - TransportValue[i]);
					TransportMoney[i] += TransportValue[i];
				}
      		}
	    }
	}
	if(newstate == PLAYER_STATE_WASTED)
	{
	    if(GetPVarInt(playerid, "EventToken") == 0)
	    {
			SetPVarInt(playerid, "MedicBill", 1);
		}
		if(ConnectedToPC[playerid] == 1337)//mdc
	    {
	        ConnectedToPC[playerid] = 0;
		}
		Seatbelt[playerid] = 0;
	}
	if(newstate == PLAYER_STATE_DRIVER)
	{
	    fVehSpeed[playerid] = 0;
		fVehHealth[playerid] = 0;
	    if(!isnull(stationidv[GetPlayerVehicleID(playerid)]))
		{
   			PlayAudioStreamForPlayerEx(playerid, stationidv[GetPlayerVehicleID(playerid)]);
		}
		
		if(PlayerInfo[playerid][pSpeedo] == 1)
	    {
	    	PlayerTextDrawShow(playerid, Tocke);
	    }

		SetPlayerArmedWeapon(playerid, 0);

		new
			newcar = GetPlayerVehicleID(playerid),
			engine, lights, alarm, doors, bonnet, boot, objective, v;

		gLastCar[playerid] = newcar;

	 	foreach(new i: Player) {
	   		v = GetPlayerVehicle(i, newcar);
		    if(v != -1) {
				if(i == playerid) {

					new
						string[96];

					format(string, sizeof(string),"Ban la chu cua xe %s.", GetVehicleName(newcar));
					SendClientMessageEx(playerid, COLOR_GREY, string);
					if(PlayerVehicleInfo[i][v][pvTicket] != 0)
					{
						format(string, sizeof(string),"Vй $%d da duoc phat hanh ve phat tren xe cua ban. Ban phai toi Trung Tam Nop phat Thanh Pho de thanh toan ngay..", PlayerVehicleInfo[i][v][pvTicket]);
						SendClientMessageEx(playerid, COLOR_GREY, string);
						SendClientMessageEx(playerid, COLOR_GREY, "Neu khong tra tien ve phat som, ban co the se phat gap doi hoac vao tu.");
					}
				}
				else if(i == PlayerInfo[playerid][pVehicleKeysFrom] && v == PlayerInfo[playerid][pVehicleKeys]) {

					new
						string[64 + MAX_PLAYER_NAME];

					format(string, sizeof(string),"Ban da nhan chмa khуa %s tu chu so huu %s.", GetVehicleName(newcar), GetPlayerNameEx(i));
					SendClientMessageEx(playerid, COLOR_GREY, string);
				}
				else if(PlayerVehicleInfo[i][v][pvLocked] == 1 && PlayerVehicleInfo[i][v][pvLock] == 1) {
				    GetVehicleParamsEx(newcar,engine,lights,alarm,doors,bonnet,boot,objective);
					SetVehicleParamsEx(newcar,engine,lights,VEHICLE_PARAMS_ON,doors,bonnet,boot,objective);
					SetTimerEx("DisableVehicleAlarm", 20000, 0, "d",  newcar);
				}
				else if(PlayerVehicleInfo[i][v][pvLocked] == 1 && PlayerVehicleInfo[i][v][pvLock] == 2) {

					new
						string[49 + MAX_PLAYER_NAME];

	          		if(PlayerInfo[playerid][pAdmin] < 2)
					{
						format(string, sizeof(string), "* %s da bi dut dien boi he thong chong trom cao cap.",GetPlayerNameEx(playerid));
						ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
						new Float:X, Float:Y, Float:Z/*, Float:HP*/;
	     				GetPlayerPos(playerid, X, Y, Z);
						////SendAudioToRange(64, 100, X, Y, Z, 20.0);
	     				SetPlayerPos(playerid, X + 1, Y, Z);
	         			RemovePlayerFromVehicle(playerid);
	         			SetPVarInt(playerid, "IsFrozen", 1);
	            		TogglePlayerControllable(playerid,0);
		            	SetTimerEx("ReleasePlayer", 10000, 0, "d", playerid);
			            GameTextForPlayer(playerid,"~r~GIAT DIEN!",11000,3);
			            /*GetPlayerHealth(playerid,HP);
			            SetPlayerHealth(playerid,HP-15);*/
					}
					else
					{
	    				format(string, sizeof(string), "Canh bao: Day %s la chu so huu boi %s.", GetVehicleName(newcar), GetPlayerNameEx(i));
	      				SendClientMessageEx(playerid, COLOR_GREY, string);
					}
				}
				return 1;
			}
		}

		for(new f = 0; f < MAX_FAMILY; f++) {
			v = GetGangVehicle(f, newcar);
			if(v != -1) {
				new string[49 + MAX_PLAYER_NAME];
				if(PlayerInfo[playerid][pFMember] == f)
				{
					format(string, sizeof(string), "You are in the family that owns this %s.", GetVehicleName(newcar));
	    			SendClientMessageEx(playerid, COLOR_GREY, string);
				}
				else if(FamilyVehicleInfo[f][v][fvLocked] == 1 && FamilyVehicleInfo[f][v][fvLock] == 1)
				{
					GetVehicleParamsEx(newcar,engine,lights,alarm,doors,bonnet,boot,objective);
					SetVehicleParamsEx(newcar,engine,lights,VEHICLE_PARAMS_ON,doors,bonnet,boot,objective);
					SetTimerEx("DisableVehicleAlarm", 20000, 0, "d",  newcar);
				}
				else if(FamilyVehicleInfo[f][v][fvLocked] == 1 && FamilyVehicleInfo[f][v][fvLock] == 2)
				{
		            format(string, sizeof(string), "* %s da bi Dut dien boi He Thong Chong Trom Cao Cap.",GetPlayerNameEx(playerid));
		            ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
		            new Float:X, Float:Y, Float:Z/*, Float:HP*/;
		            GetPlayerPos(playerid, X, Y, Z);
					//SendAudioToRange(64, 100, X, Y, Z, 20.0);
		            SetPlayerPos(playerid, X + 1, Y, Z);
		            RemovePlayerFromVehicle(playerid);
		            new Float:slx, Float:sly, Float:slz;
					GetPlayerPos(playerid, slx, sly, slz);
					SetPlayerPos(playerid, slx, sly, slz);
					SetPVarInt(playerid, "IsFrozen", 1);
		            TogglePlayerControllable(playerid,0);
		            SetTimerEx("ReleasePlayer", 10000, 0, "d", playerid);
		            GameTextForPlayer(playerid,"~r~STUNNED!",11000,3);
		            /*GetPlayerHealth(playerid,HP);
		            SetPlayerHealth(playerid,HP-15);*/
				}
				return 1;
			}
		}
		new vehicleid = newcar;
		if(IsVIPcar(vehicleid))
		{
		    if(PlayerInfo[playerid][pDonateRank] > 0)
			{
				SendClientMessageEx(playerid, COLOR_YELLOW, "VIP: Day la mot chiec xe tu VIP Gara ! Do do no khong gioi han xang.");
			}
		    else
			{
			    new Float:slx, Float:sly, Float:slz;
				GetPlayerPos(playerid, slx, sly, slz);
				SetPlayerPos(playerid, slx, sly, slz+1.3);
				PlayerPlaySound(playerid, 1130, slx, sly, slz+1.3);
			    RemovePlayerFromVehicle(playerid);
			    NOPCheck(playerid);
			    SendClientMessageEx(playerid, COLOR_GRAD2, "Ban khong phai la VIP, day la chiec xe tu Gara VIP!");
			}
		}
		else if(IsAnAmbulance(vehicleid))
		{
		    if(PlayerInfo[playerid][pMember] == 4||PlayerInfo[playerid][pLeader] == 4)
			{
			    if(FDSAVehicles[13] == vehicleid && PlayerInfo[playerid][pRank] < 5)
			    {
			        RemovePlayerFromVehicle(playerid);
			        new Float:slx, Float:sly, Float:slz;
					GetPlayerPos(playerid, slx, sly, slz);
					SetPlayerPos(playerid, slx, sly, slz);
			        NOPCheck(playerid);
					SendClientMessageEx(playerid, COLOR_GRAD2, "Chi ranks 5+ moi co the lai chiec xe nay.");
			    }
			}
		    else
			{
			    SendClientMessageEx(playerid,COLOR_GREY,"   Ban khong phai la FDSA!");
				RemovePlayerFromVehicle(playerid);
				new Float:slx, Float:sly, Float:slz;
				GetPlayerPos(playerid, slx, sly, slz);
				SetPlayerPos(playerid, slx, sly, slz);
				NOPCheck(playerid);
			}
		}
		else if(IsAnSASDCar(vehicleid))
		{
			if(PlayerInfo[playerid][pMember] == 7 || PlayerInfo[playerid][pLeader] == 7)
		    {
		    }
		    else
		    {
		        RemovePlayerFromVehicle(playerid);
		        new Float:slx, Float:sly, Float:slz;
				GetPlayerPos(playerid, slx, sly, slz);
				SetPlayerPos(playerid, slx, sly, slz);
		        NOPCheck(playerid);
		        SendClientMessageEx(playerid, COLOR_GRAD2, "Ban khong phai la SASD!");
		    }
		}
		else if(IsAnPrisonCar(vehicleid))
		{
		    if(IsACop(playerid))
			{
			}
		    else
			{
			    RemovePlayerFromVehicle(playerid);
			    new Float:slx, Float:sly, Float:slz;
				GetPlayerPos(playerid, slx, sly, slz);
				SetPlayerPos(playerid, slx, sly, slz);
			    NOPCheck(playerid);
			    SendClientMessageEx(playerid, COLOR_GRAD2, "Ban khong phai la LEO!");
			}
		}
		else if(IsAnSFPDCar(vehicleid))
		{
            if(PlayerInfo[playerid][pMember] == 3 || PlayerInfo[playerid][pLeader] == 3)
			{
			}
		    else
			{
			    RemovePlayerFromVehicle(playerid);
			    new Float:slx, Float:sly, Float:slz;
				GetPlayerPos(playerid, slx, sly, slz);
				SetPlayerPos(playerid, slx, sly, slz);
			    NOPCheck(playerid);
			    SendClientMessageEx(playerid, COLOR_GRAD2, "Ban khong phai la SFPD!");
			}
		}
		else if(IsAnEPCar(vehicleid))
		{
		    if(PlayerInfo[playerid][pMember] == 3 && PlayerInfo[playerid][pDivision] == 2 || PlayerInfo[playerid][pMember] == 3 && PlayerInfo[playerid][pRank] >= 5)
			{
			}
		    else
			{
			    RemovePlayerFromVehicle(playerid);
			    new Float:slx, Float:sly, Float:slz;
				GetPlayerPos(playerid, slx, sly, slz);
				SetPlayerPos(playerid, slx, sly, slz);
			    NOPCheck(playerid);
			    SendClientMessageEx(playerid, COLOR_GRAD2, "Ban khong la thanh vien cua SFPD Executive Protection Division!");
			}
		}
		else if(IsAnWPCar(vehicleid))
		{
		   	if(PlayerInfo[playerid][pMember] == 7 || PlayerInfo[playerid][pMember] == 7){
			}
		    else
			{
			    RemovePlayerFromVehicle(playerid);
			    new Float:slx, Float:sly, Float:slz;
				GetPlayerPos(playerid, slx, sly, slz);
				SetPlayerPos(playerid, slx, sly, slz);
			    NOPCheck(playerid);
			    SendClientMessageEx(playerid, COLOR_GRAD2, "Ban khong phai la SASD!");
			}
		}
		else if(IsACopCar(vehicleid))
		{
		    if(PlayerInfo[playerid][pMember] == 1||PlayerInfo[playerid][pLeader] == 1)
			{
			}
		    else
			{
			    RemovePlayerFromVehicle(playerid);
			    new Float:slx, Float:sly, Float:slz;
				GetPlayerPos(playerid, slx, sly, slz);
				SetPlayerPosEx(playerid, slx, sly, slz);
			    NOPCheck(playerid);
			    SendClientMessageEx(playerid, COLOR_GRAD2, "Ban khong phai la LSPD!");
			}
		}
	 	else if(IsAHouse275Car(vehicleid))
		{
		    TogglePlayerControllable(playerid, false);
	  		ShowPlayerDialog(playerid, House275CAR, DIALOG_STYLE_INPUT, "KeyPad", "Mat khau:", "ENTER", "ENTER");
		}
		else if(IsAFBICar(vehicleid))
		{
		    if(PlayerInfo[playerid][pMember] == 2||PlayerInfo[playerid][pLeader] == 2)
			{
			}
		    else
			{
			    RemovePlayerFromVehicle(playerid);
			    new Float:slx, Float:sly, Float:slz;
				GetPlayerPos(playerid, slx, sly, slz);
				SetPlayerPos(playerid, slx, sly, slz);
			    NOPCheck(playerid);
			    SendClientMessageEx(playerid, COLOR_GRAD2, "Ban khong phai la FBI!");
			}
		}
		else if(IsAnNGARMCar(vehicleid))
		{
		    if((PlayerInfo[playerid][pMember] == 11||PlayerInfo[playerid][pLeader] == 11) && (PlayerInfo[playerid][pDivision] == 2 || PlayerInfo[playerid][pDivision] == 3))
			{
			}
		    else
			{
			    RemovePlayerFromVehicle(playerid);
			    new Float:slx, Float:sly, Float:slz;
				GetPlayerPos(playerid, slx, sly, slz);
				SetPlayerPos(playerid, slx, sly, slz);
			    NOPCheck(playerid);
			    SendClientMessageEx(playerid, COLOR_GRAD2, "Ban khong phai nguoi trong SAAS ARM Division!");
			}
		}
		else if(vehicleid == FDSAVehicles[12] || vehicleid == FDSAVehicles[33] || vehicleid == FDSAVehicles[34] || vehicleid == FDSAVehicles[35])
		{
		    if(PlayerInfo[playerid][pLeader] == 4 || PlayerInfo[playerid][pMember] == 4 && PlayerInfo[playerid][pDivision] == 1)
		    {
		    }
			else
			{
			    RemovePlayerFromVehicle(playerid);
			    new Float:slx, Float:sly, Float:slz;
				GetPlayerPos(playerid, slx, sly, slz);
				SetPlayerPos(playerid, slx, sly, slz);
			    NOPCheck(playerid);
			    SendClientMessageEx(playerid, COLOR_GRAD2, "Ban khong phai la nguoi trong Fire Department Division!");
			}
		}
		else if(vehicleid == FDSAVehicles[37] || vehicleid == FDSAVehicles[36])
		{
		    if(PlayerInfo[playerid][pLeader] == 4 || PlayerInfo[playerid][pMember] == 4 && PlayerInfo[playerid][pDivision] == 2)
		    {
		    }
			else
			{
			    RemovePlayerFromVehicle(playerid);
			    new Float:slx, Float:sly, Float:slz;
				GetPlayerPos(playerid, slx, sly, slz);
				SetPlayerPos(playerid, slx, sly, slz);
			    NOPCheck(playerid);
			    SendClientMessageEx(playerid, COLOR_GRAD2, "Ban khong phai la nguoi trong Life Flight Division!");
			}
		}
		else if(IsAnNGAIRCar(vehicleid))
		{
		    if((PlayerInfo[playerid][pMember] == 11||PlayerInfo[playerid][pLeader] == 11) && (PlayerInfo[playerid][pDivision] == 1 || PlayerInfo[playerid][pDivision] == 3 ||PlayerInfo[playerid][pDivision] == 4))
			{
			}
		    else
			{
			    RemovePlayerFromVehicle(playerid);
			    new Float:slx, Float:sly, Float:slz;
				GetPlayerPos(playerid, slx, sly, slz);
				SetPlayerPos(playerid, slx, sly, slz);
			    NOPCheck(playerid);
			    SendClientMessageEx(playerid, COLOR_GRAD2, "Ban khong phai la nguoi trong SAAS AIR Division!");
			}
		}
		else if(IsAnNGCar(vehicleid))
		{
		    if(PlayerInfo[playerid][pMember] == 11||PlayerInfo[playerid][pLeader] == 11)
			{
			}
		    else
			{
			    RemovePlayerFromVehicle(playerid);
			    new Float:slx, Float:sly, Float:slz;
				GetPlayerPos(playerid, slx, sly, slz);
				SetPlayerPos(playerid, slx, sly, slz);
			    NOPCheck(playerid);
			    SendClientMessageEx(playerid, COLOR_GRAD2, "Ban khong phai la nguoi trong SAAS!");
			}
		}
		else if(IsAnDOCCar(vehicleid))
		{
		    if(PlayerInfo[playerid][pMember] == 11||PlayerInfo[playerid][pLeader] == 11)
			{
			}
		    else
			{
	   			NOPCheck(playerid);
			    RemovePlayerFromVehicle(playerid);
			    new Float:slx, Float:sly, Float:slz;
				GetPlayerPos(playerid, slx, sly, slz);
				SetPlayerPos(playerid, slx, sly, slz);
			    SendClientMessageEx(playerid, COLOR_GRAD2, "Ban khong phai nguoi trong SAAS!");
			}
		}
		else if(IsAnMPSCar(vehicleid))
		{
		    if(IsACop(playerid))
		    {
		    }
		    else
		    {
		        RemovePlayerFromVehicle(playerid);
		        new Float:slx, Float:sly, Float:slz;
				GetPlayerPos(playerid, slx, sly, slz);
				SetPlayerPos(playerid, slx, sly, slz);
		        NOPCheck(playerid);
			    SendClientMessageEx(playerid, COLOR_GRAD2, "Ban khong phai la nhan viec thuc thi phap luat.");
		    }
		}
		else if(IsACoastguardCar(vehicleid))
		{
		    if( ( PlayerInfo[playerid][pMember] == 4 || PlayerInfo[playerid][pLeader] == 4 ) || ( PlayerInfo[playerid][pMember] == 3 && PlayerInfo[playerid][pDivision] == 3 ))
			{
			}
			else
			{
			    RemovePlayerFromVehicle(playerid);
			    new Float:slx, Float:sly, Float:slz;
				GetPlayerPos(playerid, slx, sly, slz);
				SetPlayerPos(playerid, slx, sly, slz);
			    SendClientMessageEx(playerid, COLOR_GRAD2, "Ban khong phai nguoi trong Coastguard division!");
			}
		}
	 	else if(IsANewsCar(vehicleid))
		{
		    if(PlayerInfo[playerid][pMember] == 9 ||PlayerInfo[playerid][pLeader] == 9)
			{
			}
		    else
			{
			    RemovePlayerFromVehicle(playerid);
			    new Float:slx, Float:sly, Float:slz;
				GetPlayerPos(playerid, slx, sly, slz);
				SetPlayerPos(playerid, slx, sly, slz);
			    NOPCheck(playerid);
			    SendClientMessageEx(playerid, COLOR_GRAD2, "Ban khong phai nguoi trong SANews!");
			}
		}
	   	else if(IsAPlane(vehicleid))
		{
	  		if(PlayerInfo[playerid][pFlyLic] != 1)
	  		{
		  		RemovePlayerFromVehicle(playerid);
		  		new Float:slx, Float:sly, Float:slz;
				GetPlayerPos(playerid, slx, sly, slz);
				SetPlayerPos(playerid, slx, sly, slz);
		  		NOPCheck(playerid);
			 	SendClientMessageEx(playerid,COLOR_GREY,"Ban khong co giay phep lai may bay!");
	  		}
		}
		else if(TaxiVehicles[10] ==vehicleid || TaxiVehicles[11]==vehicleid || TaxiVehicles[12]==vehicleid)
		{
		    if(PlayerInfo[playerid][pMember] == 10 && PlayerInfo[playerid][pDivision] == 2|| PlayerInfo[playerid][pLeader] == 10)
			{
			}
		    else
			{
		        SendClientMessageEx(playerid,COLOR_GREY,"   Ban khong phai nguoi trong Taxi Company! (ATO Division)");
		        RemovePlayerFromVehicle(playerid);
		        new Float:slx, Float:sly, Float:slz;
				GetPlayerPos(playerid, slx, sly, slz);
				SetPlayerPos(playerid, slx, sly, slz);
		    }
		}
		else if(TaxiCompanyVehicle(vehicleid))
		{
	        if(PlayerInfo[playerid][pMember] == 10 || PlayerInfo[playerid][pLeader] == 10)
			{
			}
		    else
			{
		        SendClientMessageEx(playerid,COLOR_GREY,"   Ban khong phai nguoi trong Taxi Company!");
		        RemovePlayerFromVehicle(playerid);
		        new Float:slx, Float:sly, Float:slz;
				GetPlayerPos(playerid, slx, sly, slz);
				SetPlayerPos(playerid, slx, sly, slz);
		    }
		}
		else if(IsAHelicopter(vehicleid))
		{
		    PlayerInfo[playerid][pAGuns][GetWeaponSlot(46)] = 46;
			GivePlayerValidWeapon(playerid, 46, 60000);
		}
		else if(IsAnTaxi(vehicleid) || IsAnBus(vehicleid))
		{
	        if(PlayerInfo[playerid][pJob] == 17 || PlayerInfo[playerid][pJob2] == 17 || PlayerInfo[playerid][pMember] == 10 || PlayerInfo[playerid][pLeader] == 10 || PlayerInfo[playerid][pTaxiLicense] == 1)
			{
			}
		    else
			{
		        SendClientMessageEx(playerid,COLOR_GREY,"   Ban khong phai nguoi trong Taxi/Bus Driver!");
		        RemovePlayerFromVehicle(playerid);
		        new Float:slx, Float:sly, Float:slz;
				GetPlayerPos(playerid, slx, sly, slz);
				SetPlayerPos(playerid, slx, sly, slz);
		    }
		}

		//if(lights == VEHICLE_PARAMS_UNSET) SetVehicleParamsEx(newcar,engine,VEHICLE_PARAMS_OFF,alarm,doors,bonnet,boot,objective);
		for(new ii = 0; ii < sizeof(CrateIslandVehicles); ii++)
		{
		    if(vehicleid == CrateIslandVehicles[ii])
		    {
		        SendClientMessageEx(playerid, COLOR_GRAD1, "Crate Related Commands: /loadforklift /(un)loadplane /cargo /igps /announcetakeoff /cgun /crates /destroycrate /cratelimit");
		        SendClientMessageEx(playerid, COLOR_GRAD1, " /(un)loadcrate /delivercrate");
		        break;
		    }
		}
		if(GetCarDealershipVehicleId(newcar) != -1 && GetCarDealershipVehicleId(newcar) == GetPVarInt(playerid, "editingcdveh")) return 1;
        if(GetCarDealershipVehicleId(newcar) != -1)
        {
			new string[57 + 20 + 4];
			format(string, sizeof(string),"Ban co muon mua xe %s?\n\nVoi chi phi phai tra la $%s.", GetVehicleName(newcar), number_format(CarDealershipInfo[GetCarDealershipId(newcar)][cdVehicleCost][GetCarDealershipVehicleId(newcar)]));
		    ShowPlayerDialog(playerid,DIALOG_CDBUY,DIALOG_STYLE_MSGBOX,"Canh bao:",string,"Mua","Huy bo");
		    TogglePlayerControllable(playerid, false);
		    return 1;
        }
		GetVehicleParamsEx(newcar,engine,lights,alarm,doors,bonnet,boot,objective);
		if((engine == VEHICLE_PARAMS_UNSET || engine == VEHICLE_PARAMS_OFF) && GetVehicleModel(newcar) != 509 && GetVehicleModel(newcar) != 481 && GetVehicleModel(newcar) != 510 && vehicleid != CrateIslandVehicles[0] && vehicleid != CrateIslandVehicles[1]) {
			SendClientMessageEx(playerid, COLOR_WHITE, "Dong co cua phuong tien nay khong chay - Neu ban muon khoi dong lai, nhan {0BD611}N{FFFFFF} de khoi dong.");
		}
		else if((engine == VEHICLE_PARAMS_UNSET || engine == VEHICLE_PARAMS_OFF) && (vehicleid == CrateIslandVehicles[0] || vehicleid == CrateIslandVehicles[1]))
		{
			SendClientMessageEx(playerid, COLOR_WHITE, "You must request clearance to take off. /announcetakeoff to put in the request.");
		}
	}
	if((newstate == 2 || newstate == 3 || newstate == 7 || newstate == 9) && pTazer{playerid} == 1)
	{
		GivePlayerValidWeapon(playerid, pTazerReplace{playerid}, 60000);
		pTazer{playerid} = 0;
	}
	if(newstate == PLAYER_STATE_SPAWNED)
	{
		if(ConnectedToPC[playerid] == 1337)//mdc
	    {
	        ConnectedToPC[playerid] = 0;
		}
	}
	return 1;
}



Re: CrashDetech ? - Pottus - 20.10.2013

What the fuck is this a dozen systems in one callback? Who scripted this non-sense?