Vehicle Problem
#1

STOCK
Код:
IsACopCar(carid)
{
	for(new v = 0; v < sizeof(LSPDVehicles); v++)
	{
	    if(carid == LSPDVehicles[v]) return 1;
	}
	return 0;
}
IsAHENRYCar(carid)
{
	if(LSPDVehicles[17] == carid) return 1;
	else if(LSPDVehicles[18] == carid) return 1;
	else if(LSPDVehicles[26] == carid) return 1;
	else if(LSPDVehicles[27] == carid) return 1;
	return 0;
}
OnGameModeInit
Код:
//LAPD Main Station Vehicles
	LSPDVehicles[0] = AddStaticVehicleEx(596, 1602.5122, -1680.3663, 5.4630, 90.1200, 0, 1, FACTION_RESPAWN);
	LSPDVehicles[1] = AddStaticVehicleEx(596, 1602.4829, -1684.0609, 5.4630, 90.1200, 0, 1, FACTION_RESPAWN);
	LSPDVehicles[2] = AddStaticVehicleEx(596, 1602.5535, -1688.0438, 5.4630, 90.1200, 0, 1, FACTION_RESPAWN);
	LSPDVehicles[3] = AddStaticVehicleEx(596, 1602.6227, -1692.1034, 5.4630, 90.1200, 0, 1, FACTION_RESPAWN);
	LSPDVehicles[4] = AddStaticVehicleEx(596, 1602.4873, -1696.2058, 5.4630, 90.1200, 0, 1, FACTION_RESPAWN);
	LSPDVehicles[5] = AddStaticVehicleEx(596, 1602.5120, -1700.2861, 5.4630, 90.1200, 0, 1, FACTION_RESPAWN);
	LSPDVehicles[6] = AddStaticVehicleEx(596, 1595.6655, -1711.2139, 5.4630, 0.0000, 0, 1, FACTION_RESPAWN);
	LSPDVehicles[7] = AddStaticVehicleEx(596, 1602.4758, -1704.3666, 5.4630, 90.0000, 0, 1, FACTION_RESPAWN);
	LSPDVehicles[8] = AddStaticVehicleEx(596, 1591.5563, -1711.1929, 5.4630, 0.0000, 0, 1, FACTION_RESPAWN);
	LSPDVehicles[9] = AddStaticVehicleEx(596, 1587.1567, -1711.0308, 5.4630, 0.0000, 0, 1, FACTION_RESPAWN);
	LSPDVehicles[10] = AddStaticVehicleEx(596, 1583.3690, -1710.9269, 5.4630, 0.0000, 0, 1, FACTION_RESPAWN);
	LSPDVehicles[11] = AddStaticVehicleEx(596, 1578.6202, -1711.0103, 5.4630, 0.0000, 0, 1, FACTION_RESPAWN);
	LSPDVehicles[12] = AddStaticVehicleEx(597, 1574.6007, -1711.0599, 5.4630, 0.0000, 0, 1, FACTION_RESPAWN);
	LSPDVehicles[13] = AddStaticVehicleEx(597, 1570.4407, -1711.0914, 5.4630, 0.0000, 0, 1, FACTION_RESPAWN);
	LSPDVehicles[14] = AddStaticVehicleEx(597, 1566.0377, -1711.0865, 5.4630, 0.0000, 0, 1, FACTION_RESPAWN);
	LSPDVehicles[15] = AddStaticVehicleEx(597, 1562.2946, -1711.3041, 5.4630, 0.0000, 0, 1, FACTION_RESPAWN);
	LSPDVehicles[16] = AddStaticVehicleEx(490, 1558.7334, -1711.2596, 5.7731, 0.0000, 1, 1, FACTION_RESPAWN);
	LSPDVehicles[17] = AddStaticVehicleEx(541, 1529.7250, -1688.2800, 5.8980, 270.0000, -1, -1, FACTION_RESPAWN); // Bullet
	LSPDVehicles[18] = AddStaticVehicleEx(402, 1529.6984, -1683.8052, 5.8980, 270.0000, -1, -1, FACTION_RESPAWN); // Buffalo
	LSPDVehicles[19] = AddStaticVehicleEx(426, 1526.2618, -1644.7566, 5.4943, 180.0000, -1, -1, FACTION_RESPAWN);
	LSPDVehicles[20] = AddStaticVehicleEx(426, 1530.6189, -1644.6954, 5.4943, 180.0000, -1, -1, FACTION_RESPAWN);
	LSPDVehicles[21] = AddStaticVehicleEx(421, 1534.6064, -1644.5483, 5.4943, 180.0000, -1, -1, FACTION_RESPAWN);
	LSPDVehicles[22] = AddStaticVehicleEx(421, 1538.6061, -1644.7013, 5.4943, 180.0000, -1, -1, FACTION_RESPAWN);
	LSPDVehicles[23] = AddStaticVehicleEx(523, 1583.5237, -1680.4950, 5.3747, -60.8400, 0, 1, FACTION_RESPAWN);
	LSPDVehicles[24] = AddStaticVehicleEx(523, 1583.4276, -1677.8779, 5.3747, -60.8400, 0, 1, FACTION_RESPAWN);
	LSPDVehicles[26] = AddStaticVehicleEx(541, 1584.3937, -1671.6608, 5.6028, -89.6400, -1, -1, FACTION_RESPAWN); // Bullet
	LSPDVehicles[27] = AddStaticVehicleEx(402, 1584.2158, -1667.7837, 5.6028, -89.6400, -1, -1, FACTION_RESPAWN); // Buffalo
	LSPDVehicles[28] = AddStaticVehicleEx(528, 1543.8656, -1663.6150, 6.4303, 90.0000, 0, 1, FACTION_RESPAWN);
	LSPDVehicles[29] = AddStaticVehicleEx(528, 1543.6633, -1672.0131, 6.4303, 90.0000, 0, 1, FACTION_RESPAWN);
	LSPDVehicles[30] = AddStaticVehicleEx(427, 1543.5990, -1681.3265, 6.4303, 180.5453, 0, 1, FACTION_RESPAWN);
	LSPDVehicles[31] = AddStaticVehicleEx(498, 1544.2075, -1656.0011, 6.1636, 91.7610, 0, 1, FACTION_RESPAWN);
	LSPDVehicles[32] = AddStaticVehicleEx(596, 277.7009, -1535.2793, 24.3619, 235.9314, 0, 1, FACTION_RESPAWN);
	LSPDVehicles[33] = AddStaticVehicleEx(497, 1569.6190, -1643.7563, 28.6585, 90.2414, 0, 1, FACTION_RESPAWN);
	LSPDVehicles[34] = AddStaticVehicleEx(497, 1569.8668, -1657.8403, 28.6585, 90.2414, 0, 1, FACTION_RESPAWN);
	LSPDVehicles[54] = AddStaticVehicleEx(560,1558.5527,-1693.5159,5.6002,180.4668, 0,0, FACTION_RESPAWN); //
	LSPDVehicles[25] = AddStaticVehicleEx(560,1562.7063,-1693.5046,5.5956,181.0911, 0,0, FACTION_RESPAWN); //

	//LAPD Administration/HQ Vehicles
	LSPDVehicles[35] = AddStaticVehicleEx(596, 281.5859, -1529.8413, 24.3619, 235.9314, 0, 1, FACTION_RESPAWN);
	LSPDVehicles[36] = AddStaticVehicleEx(596, 283.7789, -1526.5203, 24.3619, 235.9314, 0, 1, FACTION_RESPAWN);
	LSPDVehicles[37] = AddStaticVehicleEx(596, 291.3855, -1545.0673, 24.3619, 414.9714, 0, 1, FACTION_RESPAWN);
	LSPDVehicles[38] = AddStaticVehicleEx(596, 294.0503, -1541.0963, 24.3619, 414.9714, 0, 1, FACTION_RESPAWN);
	LSPDVehicles[39] = AddStaticVehicleEx(598, 289.7881, -1517.6244, 24.3619, 235.9314, 0, 1, FACTION_RESPAWN);
	LSPDVehicles[40] = AddStaticVehicleEx(598, 292.9276, -1512.9407, 24.3619, 235.9314, 0, 1, FACTION_RESPAWN);
	LSPDVehicles[41] = AddStaticVehicleEx(598, 286.7833, -1521.8969, 24.3619, 235.9314, 0, 1, FACTION_RESPAWN);
	LSPDVehicles[42] = AddStaticVehicleEx(599, 296.6205, -1508.3108, 24.5123, 234.6368, 0, 1, FACTION_RESPAWN);
	LSPDVehicles[43] = AddStaticVehicleEx(599, 299.1129, -1504.3203, 24.5123, 235.5737, 0, 1, FACTION_RESPAWN);
	LSPDVehicles[44] = AddStaticVehicleEx(490, 301.4958, -1501.0891, 24.5054, -125.3400, -1, -1, FACTION_RESPAWN);
	LSPDVehicles[45] = AddStaticVehicleEx(490, 303.9569, -1497.7603, 24.4854, -125.3400, -1, -1, FACTION_RESPAWN);
	LSPDVehicles[46] = AddStaticVehicleEx(426, 298.3811, -1490.6996, 24.6063, -123.3600, -1, -1, FACTION_RESPAWN);
	LSPDVehicles[47] = AddStaticVehicleEx(426, 301.3723, -1487.1704, 24.6063, -123.3600, -1, -1, FACTION_RESPAWN);
	LSPDVehicles[48] = AddStaticVehicleEx(426, 304.7082, -1482.4991, 24.6063, -123.3600, -1, -1, FACTION_RESPAWN);
	LSPDVehicles[51] = AddStaticVehicleEx(523, 272.7154, -1532.5793, 24.6602, -123.2400, 0, 1, FACTION_RESPAWN);
	LSPDVehicles[52] = AddStaticVehicleEx(523, 274.4780, -1530.5676, 24.6602, -123.2400, 0, 1, FACTION_RESPAWN);
	LSPDVehicles[53] = AddStaticVehicleEx(601, 1544.5815, -1667.8574, 5.6494, 91.6244, 1, 1, FACTION_RESPAWN); // LAPDSWATTANK

	for(new x;x<sizeof(LSPDVehicles);x++)
	{
	    format(string, sizeof(string), "XMT %d", LSPDVehicles[x]);
	    SetVehicleNumberPlate(LSPDVehicles[x], string);
	    SetVehicleToRespawn(LSPDVehicles[x]);
		Vehicle_Armor(LSPDVehicles[x]);

	}
OnPlayerEnterVehicle
Код:
else if(IsACopCar(vehicleid))
		{
		    if(PlayerInfo[playerid][pMember] == 1||PlayerInfo[playerid][pLeader] == 1)
			{
				new string[32];
				format(string, sizeof(string), "(MDCINFO) LAPD VIN: %d", vehicleid);
				SendClientMessageEx(playerid, COLOR_YELLOW, string);
			}
		    else
			{
			    RemovePlayerFromVehicle(playerid);
			    new Float:slx, Float:sly, Float:slz;
				GetPlayerPos(playerid, slx, sly, slz);
				SetPlayerPos(playerid, slx, sly, slz);
			    defer NOPCheck(playerid);
			    SendClientMessageEx(playerid, COLOR_GRAD2, "You are not in the LAPD!");
				//TextDrawHideForPlayer(playerid, FuelText[playerid]);
				//TextDrawDestroy(Text:VHS[playerid]);
			}
		}
		else if(IsAHENRYCar(vehicleid))
		{
		    if(PlayerInfo[playerid][pMember] == 1 && PlayerInfo[playerid][pDivision] == 3)
			{
				new string[32];
				format(string, sizeof(string), "(MDCINFO) LAPD VIN: %d", vehicleid);
				SendClientMessageEx(playerid, COLOR_YELLOW, string);
			}
		    else
			{
			    RemovePlayerFromVehicle(playerid);
			    new Float:slx, Float:sly, Float:slz;
				GetPlayerPos(playerid, slx, sly, slz);
				SetPlayerPos(playerid, slx, sly, slz);
			    defer NOPCheck(playerid);
			    SendClientMessageEx(playerid, COLOR_GRAD2, "You are not in the LAPD or you're not in HENRY Division!");
				//TextDrawHideForPlayer(playerid, FuelText[playerid]);
				//TextDrawDestroy(Text:VHS[playerid]);
			}
		}
OnPlayerStateChange
Код:
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);
				SetPlayerPos(playerid, slx, sly, slz);
			    defer NOPCheck(playerid);
			    SendClientMessageEx(playerid, COLOR_GRAD2, "You are not in the LAPD!");
			}
		}
		else if(IsAHENRYCar(vehicleid))
		{
		    if(PlayerInfo[playerid][pMember] == 1&&PlayerInfo[playerid][pDivision] == 3)
			{
			}
		    else
			{
			    RemovePlayerFromVehicle(playerid);
			    new Float:slx, Float:sly, Float:slz;
				GetPlayerPos(playerid, slx, sly, slz);
				SetPlayerPos(playerid, slx, sly, slz);
			    defer NOPCheck(playerid);
			    SendClientMessageEx(playerid, COLOR_GRAD2, "You are not in the LAPD or you're not in HENRY Division!");
			}
		}
The Problem
Код:
Well even tho I got that script, Even I'm in any division I can still enter the IsAHENRYCars (But I got leader = 1).
Reply
#2

Could you explain the issue better?
Reply
#3

PHP код:
else if(IsAHENRYCar(vehicleid))//delete else
        
{
            if(
PlayerInfo[playerid][pMember] == 1&&PlayerInfo[playerid][pDivision] == 3)
            {
            }
            else
            {
                
RemovePlayerFromVehicle(playerid);
                new 
Float:slxFloat:slyFloat:slz;
                
GetPlayerPos(playeridslxslyslz);
                
SetPlayerPos(playeridslxslyslz);
                
defer NOPCheck(playerid);
                
SendClientMessageEx(playeridCOLOR_GRAD2"You are not in the LAPD or you're not in HENRY Division!");
            }
        } 
Reply
#4

if(PlayerInfo[playerid][pMember] == 1&&PlayerInfo[playerid][pDivision] == 3)

switch to

if(PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pDivision] == 3)

U wrote "You are not in the LAPD or you're not in HENRY Division!"); "

Your first code tho requires to be Member and in division.
Reply
#5

Quote:
Originally Posted by SickAttack
Посмотреть сообщение
Could you explain the issue better?
It should be if you are in Division 3 you can enter HENRYCars but if not you will automatically removed from the car, But it's not working even I'm in any division number.
Reply
#6

BUMP
Reply
#7

Quote:
Originally Posted by lwilson
Посмотреть сообщение
BUMP
Its because you first ask if the vehicle is a cop vehicle...

Well, and all IsAHENRYCar are Cop Vehicles...so this get ignored...

So change your IsACopCar function:

Код:
IsACopCar(carid)
{
	for(new v = 0; v < sizeof(LSPDVehicles); v++)
	{
            if(v == 17 || v == 18 || v == 26 || v == 27) continue;
	    if(carid == LSPDVehicles[v]) return 1;
	}
	return 0;
}
Greekz
Reply
#8

Quote:
Originally Posted by Kaliber
Посмотреть сообщение
Its because you first ask if the vehicle is a cop vehicle...

Well, and all IsAHENRYCar are Cop Vehicles...so this get ignored...

So change your IsACopCar function:

Код:
IsACopCar(carid)
{
	for(new v = 0; v < sizeof(LSPDVehicles); v++)
	{
            if(v == 17 || v == 18 || v == 26 || v == 27) continue;
	    if(carid == LSPDVehicles[v]) return 1;
	}
	return 0;
}
Greekz
Should I add the IsAHENRYCar too? you really helping me, wish I could give 2 or more reps. I gave you one already.
Reply
#9

Quote:
Originally Posted by lwilson
Посмотреть сообщение
Should I add the IsAHENRYCar too?
I don't know what you exactly mean by that, but you must only change the IsACopCar function, that fixxed it all
Reply
#10

Quote:
Originally Posted by Kaliber
Посмотреть сообщение
I don't know what you exactly mean by that, but you must only change the IsACopCar function, that fixxed it all
Thanks it works! But what if I want to add more? Like IsATOMCar what would be the format of IsACopCar?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)