#define GANG_CIV 0 #define GANG_US 1 #define GANG_T 2 #define GANG_PMC 3 #define GANG_UK 4 enum TeamVehs { USveh, UKveh, Taliveh, PMCveh } new gTeam[MAX_PLAYERS]; new Veh[TeamVehs]; public OnGameModeInit() { AddStaticVehicle(543,-741.3320,2750.9011,47.0458,181.2065,255,255); // Sadler (CIV) Veh[Taliveh] = AddStaticVehicle(455,-1453.3641,2624.9502,56.2726,270.7139,255,255); // Flatbed (Tali) Veh[PMCveh] = AddStaticVehicle(487,-655.3591,949.7514,12.2784,93.0401,33,33); // Maverick (PMC) Veh[USveh] = AddStaticVehicle(548,328.1077,1850.7454,19.1915,90.0070,81,81); // Cargobob (US) Veh[UKveh] = AddStaticVehicle(520,-1457.0353,501.5562,18.9917,269.4383,0,0); // Hydra (UK) return 1; } public OnPlayerStateChange(playerid, newstate, oldstate) { if(newstate == 2) { new VehCheck = GetPlayerVehicleID(playerid); if(VehCheck == Veh[USveh] ) { if(gTeam[playerid] == GANG_US) { RemovePlayerFromVehicle(playerid); SendClientMessage(playerid, COLOR_RED, "{ff6347}Error: You don't have access to this vehicle!"); return 1; } } if(VehCheck == Veh[Taliveh] ) { if(gTeam[playerid] == GANG_T) { RemovePlayerFromVehicle(playerid); SendClientMessage(playerid, COLOR_RED, "{ff6347}Error: You don't have access to this vehicle!"); return 1; } } if(VehCheck == Veh[PMCveh] ) { if(gTeam[playerid] == GANG_PMC) { RemovePlayerFromVehicle(playerid); SendClientMessage(playerid, COLOR_RED, "{ff6347}Error: You don't have access to this vehicle!"); return 1; } } if(VehCheck == Veh[UKveh] ) { if(gTeam[playerid] == GANG_UK) { RemovePlayerFromVehicle(playerid); SendClientMessage(playerid, COLOR_RED, "{ff6347}Error: You don't have access to this vehicle!"); return 1; } } return 1; } return 1; }
public OnGameModeInit() { AddStaticVehicle(404,-240.3871,2609.1855,62.4385,178.8446,109,100); // ALL_CAN_ENTER AddStaticVehicle(408,-276.2446,2655.8201,63.1989,270.1121,26,26); // ALL_CAN_ENTER AddStaticVehicle(424,-215.7718,2777.6672,62.2502,269.3476,2,2); // ALL_CAN_ENTER Veh[Taliveh] = AddStaticVehicle(568,-1565.5852,2638.3340,55.6556,89.3129,1,1); // ALL_CAN_ENTER Veh[Taliveh] = AddStaticVehicle(470,-1563.2689,2694.5530,55.7585,179.6360,1,1); // ALL_CAN_ENTER Veh[Taliveh] = AddStaticVehicle(469,-1276.0333,2490.6409,86.9348,151.4670,1,1); // TALI_CANNOT_ENTER Veh[PMCveh] = AddStaticVehicle(473,-660.8072,875.4515,-0.2219,226.3900,33,33); // ALL_CAN_ENTER Veh[PMCveh] = AddStaticVehicle(468,-686.3440,973.6500,11.8031,29.6308,33,33); // ALL_CAN_ENTER Veh[PMCveh] = AddStaticVehicle(554,-681.0616,967.7052,12.2172,90.8313,33,33); //PMC_CANNOT_ENTER Veh[USveh] = AddStaticVehicle(523,146.8226,1930.8507,18.7541,90.4055,81,81); // ALL_CAN_ENTER Veh[USveh] = AddStaticVehicle(500,181.7266,1925.9727,18.0581,179.9284,81,81); // ALL_CAN_ENTER Veh[USveh] = AddStaticVehicle(470,176.9072,1925.9727,18.0926,179.9285,81,81); // US_CANNOT_ENTER Veh[UKveh] = AddStaticVehicle(445,-1561.7638,387.1261,7.0625,90.1433,0,0); // ALL_CAN_ENTER Veh[UKveh] = AddStaticVehicle(425,-1608.2104,286.0438,7.7102,180.6974,1,1); // ALL_CAN_ENTER Veh[UKveh] = AddStaticVehicle(430,-1653.0719,253.9239,-0.0595,91.4524,0,0); // UK_CANNOT_ENTER return 1; }
Update;
Okay, I found the error but I am still not sure how to fix it. If I join "GANG_US" I cannot enter the last vehicle (I removed most vehicles so the above wasn't cluttered) added to "OnGameModeInit" defined "Veh[USveh]". Example; Код:
public OnGameModeInit() { AddStaticVehicle(404,-240.3871,2609.1855,62.4385,178.8446,109,100); // ALL_CAN_ENTER AddStaticVehicle(408,-276.2446,2655.8201,63.1989,270.1121,26,26); // ALL_CAN_ENTER AddStaticVehicle(424,-215.7718,2777.6672,62.2502,269.3476,2,2); // ALL_CAN_ENTER Veh[Taliveh] = AddStaticVehicle(568,-1565.5852,2638.3340,55.6556,89.3129,1,1); // ALL_CAN_ENTER Veh[Taliveh] = AddStaticVehicle(470,-1563.2689,2694.5530,55.7585,179.6360,1,1); // ALL_CAN_ENTER Veh[Taliveh] = AddStaticVehicle(469,-1276.0333,2490.6409,86.9348,151.4670,1,1); // TALI_CANNOT_ENTER Veh[PMCveh] = AddStaticVehicle(473,-660.8072,875.4515,-0.2219,226.3900,33,33); // ALL_CAN_ENTER Veh[PMCveh] = AddStaticVehicle(468,-686.3440,973.6500,11.8031,29.6308,33,33); // ALL_CAN_ENTER Veh[PMCveh] = AddStaticVehicle(554,-681.0616,967.7052,12.2172,90.8313,33,33); //PMC_CANNOT_ENTER Veh[USveh] = AddStaticVehicle(523,146.8226,1930.8507,18.7541,90.4055,81,81); // ALL_CAN_ENTER Veh[USveh] = AddStaticVehicle(500,181.7266,1925.9727,18.0581,179.9284,81,81); // ALL_CAN_ENTER Veh[USveh] = AddStaticVehicle(470,176.9072,1925.9727,18.0926,179.9285,81,81); // US_CANNOT_ENTER Veh[UKveh] = AddStaticVehicle(445,-1561.7638,387.1261,7.0625,90.1433,0,0); // ALL_CAN_ENTER Veh[UKveh] = AddStaticVehicle(425,-1608.2104,286.0438,7.7102,180.6974,1,1); // ALL_CAN_ENTER Veh[UKveh] = AddStaticVehicle(430,-1653.0719,253.9239,-0.0595,91.4524,0,0); // UK_CANNOT_ENTER return 1; } |
public OnPlayerStateChange(playerid, newstate, oldstate) { if(newstate == 2) { new VehCheck = GetPlayerVehicleID(playerid); if(VehCheck == Veh[USveh] ) { if(gTeam[playerid] != GANG_US) { RemovePlayerFromVehicle(playerid); SendClientMessage(playerid, COLOR_RED, "{ff6347}Error: You don't have access to this vehicle!"); return 1; } } if(VehCheck == Veh[Taliveh] ) { if(gTeam[playerid] != GANG_T) { RemovePlayerFromVehicle(playerid); SendClientMessage(playerid, COLOR_RED, "{ff6347}Error: You don't have access to this vehicle!"); return 1; } } if(VehCheck == Veh[PMCveh] ) { if(gTeam[playerid] != GANG_PMC) { RemovePlayerFromVehicle(playerid); SendClientMessage(playerid, COLOR_RED, "{ff6347}Error: You don't have access to this vehicle!"); return 1; } } if(VehCheck == Veh[UKveh] ) { if(gTeam[playerid] != GANG_UK) { RemovePlayerFromVehicle(playerid); SendClientMessage(playerid, COLOR_RED, "{ff6347}Error: You don't have access to this vehicle!"); return 1; } } } return 1; }
public OnPlayerStateChange(playerid, newstate, oldstate) { if(newstate == 4) { new VehCheck = GetPlayerVehicleID(playerid); if(VehCheck == Veh[USveh1] || VehCheck == Veh[USveh2] || VehCheck == Veh[USveh3] || VehCheck == Veh[USveh4] || VehCheck == Veh[USveh5] || VehCheck == Veh[USveh6] || VehCheck == Veh[USveh7] || VehCheck == Veh[USveh8] || VehCheck == Veh[USveh9] || VehCheck == Veh[USveh10] || VehCheck == Veh[USveh11] || VehCheck == Veh[USveh12] || VehCheck == Veh[USveh13] || VehCheck == Veh[USveh14] || VehCheck == Veh[USveh15] ) { if(gTeam[playerid] != GANG_US) { RemovePlayerFromVehicle(playerid); SendClientMessage(playerid, COLOR_RED, "{ff6347}Error: You don't have access to this vehicle!"); return 1; } } if(VehCheck == Veh[Taliveh1] || VehCheck == Veh[Taliveh2] || VehCheck == Veh[Taliveh3] || VehCheck == Veh[Taliveh4] || VehCheck == Veh[Taliveh5] || VehCheck == Veh[Taliveh6] || VehCheck == Veh[Taliveh7] || VehCheck == Veh[Taliveh8] || VehCheck == Veh[Taliveh9] || VehCheck == Veh[Taliveh10]) { if(gTeam[playerid] != GANG_T) { RemovePlayerFromVehicle(playerid); SendClientMessage(playerid, COLOR_RED, "{ff6347}Error: You don't have access to this vehicle!"); return 1; } } if(VehCheck == Veh[PMCveh1] || VehCheck == Veh[PMCveh2] || VehCheck == Veh[PMCveh3] || VehCheck == Veh[PMCveh4]|| VehCheck == Veh[PMCveh5] || VehCheck == Veh[PMCveh6] || VehCheck == Veh[PMCveh7] || VehCheck == Veh[PMCveh8] || VehCheck == Veh[PMCveh9] ) { if(gTeam[playerid] != GANG_PMC) { RemovePlayerFromVehicle(playerid); SendClientMessage(playerid, COLOR_RED, "{ff6347}Error: You don't have access to this vehicle!"); return 1; } } if(VehCheck == Veh[UKveh1] || VehCheck == Veh[UKveh2] || VehCheck == Veh[UKveh3] || VehCheck == Veh[UKveh4] || VehCheck == Veh[UKveh5] || VehCheck == Veh[UKveh6] || VehCheck == Veh[UKveh7] || VehCheck == Veh[UKveh8] || VehCheck == Veh[UKveh9] || VehCheck == Veh[UKveh10] || VehCheck == Veh[UKveh11] || VehCheck == Veh[UKveh12] || VehCheck == Veh[UKveh13] || VehCheck == Veh[UKveh14] || VehCheck == Veh[UKveh15] || VehCheck == Veh[UKveh16] || VehCheck == Veh[UKveh17]) { if(gTeam[playerid] != GANG_UK) { RemovePlayerFromVehicle(playerid); SendClientMessage(playerid, COLOR_RED, "{ff6347}Error: You don't have access to this vehicle!"); return 1; } } return 1; } return 1; }
Veh[Taliveh] = AddStaticVehicle(568,-1565.5852,2638.3340,55.6556,89.3129,1,1); // ALL_CAN_ENTER Veh[Taliveh] = AddStaticVehicle(470,-1563.2689,2694.5530,55.7585,179.6360,1,1); // ALL_CAN_ENTER Veh[Taliveh] = AddStaticVehicle(469,-1276.0333,2490.6409,86.9348,151.4670,1,1); // TALI_CANNOT_ENTER