//includes #include <a_samp> #include <zcmd> #pragma tabsize 0 // define the teams!! #define CIVILIAN 1 #define POLICE 2 #define PSD 3 #define MECHANIC 4 #define ASSASSIN 5 #define DOCK 6 #define HITMAN 7 #define MEDIC 8 #define PILOT 9 #define FIRE 10 // Teams colours! #define CIVILIAN_COLOUR 0xFFFFFFFF #define POLICE_COLOUR 0x00F2FFAA #define PSD_COLOUR 0xED07F5FF #define MECHANIC_COLOUR 0xB0B0B0FF #define ASSASSIN_COLOUR 0xFFFFFFFF #define DOCK_COLOUR 0x3B5451FF #define HITMAN_COLOUR 0x7D6256FF #define MEDIC_COLOUR 0x05FFC5FF #define PILOT_COLOUR 0xFF6505AA #define FIRE_COLOUR 0x663434FF new gTeam[MAX_PLAYERS]; #if defined FILTERSCRIPT public OnFilterScriptInit() { return 1; } public OnFilterScriptExit() { return 1; } #else main() { } #endif public OnGameModeInit() { SetGameModeText("RolePlay"); DisableInteriorEnterExits(); SendRconCommand("mapname San Andreas"); UsePlayerPedAnims(); // put under "OnGameModeInit" ShowPlayerMarkers(0); // teams AddPlayerClass(250,1071.0199,-1776.8431,13.3369,2.1094,0,0,0,0,0,0); // CIVILIAN AddPlayerClass(56,1071.0199,-1776.8431,13.3369,2.1094,0,0,0,0,0,0); // CIVILIAN AddPlayerClass(266,1543.5481,-1675.7903,13.5567,88.9385,0,0,0,0,0,0); // Police officer(cop) AddPlayerClass(194,1543.5481,-1675.7903,13.5567,88.9385,0,0,0,0,0,0); // Police officer(cop) AddPlayerClass(255,1763.2751,-1895.4948,13.5620,268.0899,0,0,0,0,0,0); // psd AddPlayerClass(253,1763.2751,-1895.4948,13.5620,268.0899,0,0,0,0,0,0); // psd AddPlayerClass(269,2098.3645,-2004.6563,13.5469,110.2789,0,0,0,0,0,0); // mechanic AddPlayerClass(50,2098.3645,-2004.6563,13.5469,110.2789,0,0,0,0,0,0); // mechanic AddPlayerClass(73,1242.5288,-2036.9237,60.0808,273.9413,0,0,0,0,0,0); // assassin AddPlayerClass(86,1242.5288,-2036.9237,60.0808,273.9413,0,0,0,0,0,0); // assassin AddPlayerClass(8,-1733.4540,37.4321,3.5547,279.3711,0,0,0,0,0,0); // dock worker AddPlayerClass(42,-1733.4540,37.4321,3.5547,279.3711,0,0,0,0,0,0); // dock worker AddPlayerClass(127,-85.1014,1378.7714,10.2734,279.5074,0,0,0,0,0,0); // hitman AddPlayerClass(93,-85.1014,1378.7714,10.2734,279.5074,0,0,0,0,0,0); // hitman AddPlayerClass(276,1178.3052,-1324.3866,14.1135,272.7904,0,0,0,0,0,0); // med AddPlayerClass(308,1178.3052,-1324.3866,14.1135,272.7904,0,0,0,0,0,0); // med AddPlayerClass(61,1952.8932,-2177.6560,13.5469,353.2874,0,0,0,0,0,0); // pilot AddPlayerClass(93,1952.8932,-2177.6560,13.5469,353.2874,0,0,0,0,0,0); // pilot AddPlayerClass(277,1748.1133,-1453.2034,13.5469,343.4247,0,0,0,0,0,0); // fire man AddPlayerClass(279,1748.1133,-1453.2034,13.5469,343.4247,0,0,0,0,0,0); // fire man //Vehicles AddStaticVehicle(577,1900.7354,-2285.5532,13.4739,270.5604,8,7); // Pilot22 AddStaticVehicle(511,1992.1445,-2315.1384,14.9204,90.4906,4,90); // pilot22 AddStaticVehicle(511,1991.2150,-2381.6353,14.9171,92.0458,4,90); // pilot22 AddStaticVehicle(540,-79.1585,1340.4513,10.8807,6.7190,42,42); // hit11 AddStaticVehicle(540,-85.2413,1340.4451,10.6214,5.2560,42,42); // hit11 AddStaticVehicle(540,-91.6653,1339.2793,10.4139,6.8197,42,42); // hit11 AddStaticVehicle(540,-97.8659,1338.6925,10.2024,6.0719,42,42); // hit11 AddStaticVehicle(540,-104.1406,1336.9240,10.0225,6.1459,42,42); // hit11 AddStaticVehicle(530,-1703.0383,26.7885,3.3219,45.6247,96,1); // dockss AddStaticVehicle(453,-1629.4510,166.5271,-0.3037,43.0922,56,56); // dockss AddStaticVehicle(453,-1634.6537,161.4186,-0.2678,46.1311,56,56); // dockss AddStaticVehicle(414,-1700.8918,109.4072,3.6483,137.2017,28,1); // dockss AddStaticVehicle(414,-1695.9113,102.7240,3.6484,136.4055,28,1); // dockss AddStaticVehicle(414,-1689.5900,98.1266,3.6484,136.1141,28,1); // dockss AddStaticVehicle(419,1246.9327,-2011.0464,59.5897,180.7608,47,76); // assassss AddStaticVehicle(419,1253.3091,-2011.0476,59.4088,179.0744,47,76); // assassss AddStaticVehicle(419,1263.1310,-2011.0758,59.1284,181.2151,47,76); // assassss AddStaticVehicle(419,1272.6150,-2011.5566,58.8571,179.8617,47,76); // assassss AddStaticVehicle(525,2078.5166,-2010.9529,13.4282,269.5139,17,20); // mechanicsscasc AddStaticVehicle(525,2078.4646,-2003.8898,13.4060,269.1910,17,20); // mechanicsscasc AddStaticVehicle(525,2068.5046,-1997.1852,13.4221,272.1003,17,20); // mechanicsscasc AddStaticVehicle(525,2065.5330,-1990.7363,13.4534,272.0720,17,20); // mechanicsscasc AddStaticVehicle(420,1777.8099,-1912.6986,13.1657,270.7092,6,1); // taxi AddStaticVehicle(420,1777.9800,-1906.8815,13.1658,268.8771,6,1); // taxi AddStaticVehicle(420,1777.8800,-1900.2737,13.1677,268.6656,6,1); // taxi AddStaticVehicle(420,1778.2097,-1893.7990,13.1695,269.3786,6,1); // taxi AddStaticVehicle(420,1778.4995,-1886.5010,13.1657,270.3654,6,1); // taxi AddStaticVehicle(431,1777.7548,-1928.8018,13.4913,358.5206,75,59); // buss AddStaticVehicle(431,1784.7960,-1929.0233,13.4854,1.2589,75,59); // buss AddStaticVehicle(431,1790.4385,-1928.9188,13.4920,359.7748,75,59); // buss AddStaticVehicle(431,1796.2185,-1929.5474,13.4883,1.0316,75,59); // buss AddStaticVehicle(431,1803.5100,-1929.3397,13.4843,0.9385,75,59); // buss AddStaticVehicle(596,1535.8578,-1677.9369,13.1044,359.6648,0,1); // cops AddStaticVehicle(596,1535.7859,-1667.0427,13.1042,359.7203,0,1); // cops AddStaticVehicle(596,1601.0013,-1684.1238,5.6118,89.3490,0,1); // cops AddStaticVehicle(596,1602.1743,-1691.7617,5.6107,89.1581,0,1); // cops AddStaticVehicle(596,1601.8490,-1700.1804,5.6125,88.6244,0,1); // cops AddStaticVehicle(523,1604.2047,-1708.6970,5.4628,45.4675,0,0); // copss AddStaticVehicle(523,1602.5605,-1710.8755,5.4610,48.0118,0,0); // copss AddStaticVehicle(523,1598.0466,-1713.0381,5.4618,0.7185,0,0); // copss AddStaticVehicle(510,1063.6793,-1775.9258,12.9517,272.8377,46,46); // civilll AddStaticVehicle(510,1063.3281,-1769.9362,12.9726,271.0715,46,46); // civilll AddStaticVehicle(510,1063.5045,-1772.9581,12.9618,272.2037,46,46); // civilll AddStaticVehicle(411,1062.9855,-1763.6332,13.1193,270.7665,64,1); // civilll AddStaticVehicle(411,1098.9248,-1763.9442,13.0763,267.5032,64,1); // civilll AddStaticVehicle(475,1062.9132,-1743.2294,13.2687,269.9456,9,39); // civilll AddStaticVehicle(475,1078.7573,-1763.8707,13.1756,270.3465,9,39); // civilll AddStaticVehicle(560,1083.4089,-1755.0792,13.0921,271.8628,9,39); // civillll AddStaticVehicle(589,1098.1686,-1755.0533,13.0149,88.9525,31,31); // civillll AddStaticVehicle(416,1181.1697,-1309.3839,13.8037,269.9174,1,3); // medddd AddStaticVehicle(416,1181.2279,-1338.8867,13.8827,268.9961,1,3); // medddd AddStaticVehicle(416,1140.9242,-1382.3412,13.9387,179.5405,1,3); // medddd AddStaticVehicle(416,1148.4689,-1380.6226,13.9568,180.2622,1,3); // medddd AddStaticVehicle(416,1137.0083,-1295.7498,13.7101,0.2067,1,3); // medddd AddStaticVehicle(416,1147.0767,-1294.0543,13.8008,4.4205,1,3); // medddd AddStaticVehicle(407,1753.6068,-1455.8077,13.7837,351.6242,3,1); // fiererererer AddStaticVehicle(407,1743.6035,-1455.3623,13.7654,358.6827,3,1); // fiererererer AddPlayerClass(276,1748.1133,-1453.2034,13.5469,343.4247,0,0,0,0,0,0); // fire man return 1; } stock SetPlayerToTeamColour(playerid) { if(gTeam[playerid] == CIVILIAN) SetPlayerColor(playerid, CIVILIAN_COLOUR); if(gTeam[playerid] == POLICE) SetPlayerColor(playerid, POLICE_COLOUR); if(gTeam[playerid] == PSD) SetPlayerColor(playerid, PSD_COLOUR); if(gTeam[playerid] == MECHANIC) SetPlayerColor(playerid, MECHANIC_COLOUR); if(gTeam[playerid] == ASSASSIN) SetPlayerColor(playerid, ASSASSIN_COLOUR); if(gTeam[playerid] == DOCK) SetPlayerColor(playerid, DOCK_COLOUR); if(gTeam[playerid] == HITMAN) SetPlayerColor(playerid, HITMAN_COLOUR); if(gTeam[playerid] == MEDIC) SetPlayerColor(playerid, MEDIC_COLOUR); if(gTeam[playerid] == PILOT) SetPlayerColor(playerid, PILOT_COLOUR); if(gTeam[playerid] == FIRE) SetPlayerColor(playerid, PILOT_COLOUR); } stock SetPlayerTeamFromClass(playerid, classid) { if(classid == 0 || 1) gTeam[playerid] = CIVILIAN; if(classid == 2 || 3) gTeam[playerid] = POLICE; if(classid == 4 || 5) gTeam[playerid] = PSD; if(classid == 6 || 7) gTeam[playerid] = MECHANIC; if(classid == 8 || 9) gTeam[playerid] = ASSASSIN; if(classid == 10 || 11) gTeam[playerid] = DOCK; if(classid == 12 || 13) gTeam[playerid] = HITMAN; if(classid == 14 || 15) gTeam[playerid] = MEDIC; if(classid == 16 || 17) gTeam[playerid] = PILOT; if(classid == 18 || 19) gTeam[playerid] = FIRE; }
new CivilCar[2];
CivilCar[0] = AddStaticVehicle(560,1083.4089,-1755.0792,13.0921,271.8628,9,39); // civillll
CivilCar[1] = AddStaticVehicle(589,1098.1686,-1755.0533,13.0149,88.9525,31,31); // civillll
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER)
{
if(GetPlayerVehicleID(playerid) == CivilCar[0] || GetPlayerVehicleID(playerid) == CivilCar[1])
{
if(gTeam[playerid] != CIVILIAN)
{
SendClientMessage(playerid,COLOR_RED,"Only civilians can use these vehicles.");
RemovePlayerFromVehicle(playerid);
return 1;
}
SendClientMessage(playerid,-1,"[[_Civilian Vehicle_]]");
SendClientMessage(playerid,CIVILIAN_COLOUR,"Welcome to your Civilian vehicle.");
return 1;
}
}
I'll give you an exemple, and you do the rest.
So, you have to define your cars at the top : PHP код:
PHP код:
PHP код:
|
//includes #include <a_samp> #include <zcmd> #include <Dini> // This include is use for saving data's #include <Dutils> // This include is used for some important function #include <Dudb> // This include is used for hashing password #pragma tabsize 0 #define savefolder "Teams/Players/%s.ini" // This defines the file name and folder #pragma unused ret_memcpy // This avoid the ret_memcpy warning // define the teams!! #define CIVILIAN 1 #define POLICE 2 #define PSD 3 #define MECHANIC 4 #define ASSASSIN 5 #define DOCK 6 #define HITMAN 7 #define MEDIC 8 #define PILOT 9 #define FIRE 10 // Teams colours! #define CIVILIAN_COLOUR 0xFFFFFFFF #define POLICE_COLOUR 0x00F2FFAA #define PSD_COLOUR 0xED07F5FF #define MECHANIC_COLOUR 0xB0B0B0FF #define ASSASSIN_COLOUR 0xFFFFFFFF #define DOCK_COLOUR 0x3B5451FF #define HITMAN_COLOUR 0x7D6256FF #define MEDIC_COLOUR 0x05FFC5FF #define PILOT_COLOUR 0xFF6505AA #define FIRE_COLOUR 0x663434FF new gate; new bool:gateopen; new policec[8]; new psdc[10]; new assassinc[4]; new dockc[6]; new hitmanc[5]; new mechanics[4]; new pilotc[3]; new firec[2]; new medics[6]; new gTeam[MAX_PLAYERS]; #if defined FILTERSCRIPT public OnFilterScriptInit() { return 1; } public OnFilterScriptExit() { return 1; } #else main() { } #endif public OnGameModeInit() { SetTimer("GateCheck", 800, true); //This is used to create the timer. The "GateCheck" is the callback we'll be using, // the '800' is the amount of milliseconds between each call and the 'true' indicates that this timer is looping endlessly gate = CreateObject(980, 1961.97131, -2189.60107, 15.47873, 0.00000, 0.00000, 0.00000); //'gate = CreateObject(...);' = Assigns the object id of the gate to the 'gate' variable //16442 = object model id < change it to the model id you use for your gate // 8.0, 3.0, 10.0 = coordinates of the gate // 0.0, 0.0, 0.0 = Rotation of the gate. None in this case. SetGameModeText("RolePlay"); DisableInteriorEnterExits(); SendRconCommand("mapname San Andreas"); UsePlayerPedAnims(); // put under "OnGameModeInit" ShowPlayerMarkers(0); // teams AddPlayerClass(250,1071.0199,-1776.8431,13.3369,2.1094,0,0,0,0,0,0); // CIVILIAN AddPlayerClass(56,1071.0199,-1776.8431,13.3369,2.1094,0,0,0,0,0,0); // CIVILIAN AddPlayerClass(266,1543.5481,-1675.7903,13.5567,88.9385,0,0,0,0,0,0); // Police officer(cop) AddPlayerClass(194,1543.5481,-1675.7903,13.5567,88.9385,0,0,0,0,0,0); // Police officer(cop) AddPlayerClass(255,1763.2751,-1895.4948,13.5620,268.0899,0,0,0,0,0,0); // psd AddPlayerClass(253,1763.2751,-1895.4948,13.5620,268.0899,0,0,0,0,0,0); // psd AddPlayerClass(269,2098.3645,-2004.6563,13.5469,110.2789,0,0,0,0,0,0); // mechanic AddPlayerClass(50,2098.3645,-2004.6563,13.5469,110.2789,0,0,0,0,0,0); // mechanic AddPlayerClass(73,1242.5288,-2036.9237,60.0808,273.9413,0,0,0,0,0,0); // assassin AddPlayerClass(86,1242.5288,-2036.9237,60.0808,273.9413,0,0,0,0,0,0); // assassin AddPlayerClass(8,-1733.4540,37.4321,3.5547,279.3711,0,0,0,0,0,0); // dock worker AddPlayerClass(42,-1733.4540,37.4321,3.5547,279.3711,0,0,0,0,0,0); // dock worker AddPlayerClass(127,-85.1014,1378.7714,10.2734,279.5074,0,0,0,0,0,0); // hitman AddPlayerClass(93,-85.1014,1378.7714,10.2734,279.5074,0,0,0,0,0,0); // hitman AddPlayerClass(276,1178.3052,-1324.3866,14.1135,272.7904,0,0,0,0,0,0); // med AddPlayerClass(308,1178.3052,-1324.3866,14.1135,272.7904,0,0,0,0,0,0); // med AddPlayerClass(61,1952.8932,-2177.6560,13.5469,353.2874,0,0,0,0,0,0); // pilot AddPlayerClass(93,1952.8932,-2177.6560,13.5469,353.2874,0,0,0,0,0,0); // pilot AddPlayerClass(277,1748.1133,-1453.2034,13.5469,343.4247,0,0,0,0,0,0); // fire man AddPlayerClass(279,1748.1133,-1453.2034,13.5469,343.4247,0,0,0,0,0,0); // fire man //Vehicles pilotc[0] = AddStaticVehicle(577,1900.7354,-2285.5532,13.4739,270.5604,8,7); // Pilot22 pilotc[1] = AddStaticVehicle(511,1992.1445,-2315.1384,14.9204,90.4906,4,90); // pilot22 pilotc[2] = AddStaticVehicle(511,1991.2150,-2381.6353,14.9171,92.0458,4,90); // pilot22 hitmanc[0] = AddStaticVehicle(540,-79.1585,1340.4513,10.8807,6.7190,42,42); // hit11 hitmanc[1] = AddStaticVehicle(540,-85.2413,1340.4451,10.6214,5.2560,42,42); // hit11 hitmanc[2] = AddStaticVehicle(540,-91.6653,1339.2793,10.4139,6.8197,42,42); // hit11 hitmanc[3] = AddStaticVehicle(540,-97.8659,1338.6925,10.2024,6.0719,42,42); // hit11 hitmanc[4] = AddStaticVehicle(540,-104.1406,1336.9240,10.0225,6.1459,42,42); // hit11 dockc[0] = AddStaticVehicle(530,-1703.0383,26.7885,3.3219,45.6247,96,1); // dockss dockc[1] = AddStaticVehicle(453,-1629.4510,166.5271,-0.3037,43.0922,56,56); // dockss dockc[2] = AddStaticVehicle(453,-1634.6537,161.4186,-0.2678,46.1311,56,56); // dockss dockc[3] = AddStaticVehicle(414,-1700.8918,109.4072,3.6483,137.2017,28,1); // dockss dockc[4] = AddStaticVehicle(414,-1695.9113,102.7240,3.6484,136.4055,28,1); // dockss dockc[5] = AddStaticVehicle(414,-1689.5900,98.1266,3.6484,136.1141,28,1); // dockss assassinc[0] = AddStaticVehicle(419,1246.9327,-2011.0464,59.5897,180.7608,47,76); // assassss assassinc[1] = AddStaticVehicle(419,1253.3091,-2011.0476,59.4088,179.0744,47,76); // assassss assassinc[2] = AddStaticVehicle(419,1263.1310,-2011.0758,59.1284,181.2151,47,76); // assassss assassinc[3] = AddStaticVehicle(419,1272.6150,-2011.5566,58.8571,179.8617,47,76); // assassss mechanics[0] = AddStaticVehicle(525,2078.5166,-2010.9529,13.4282,269.5139,17,20); // mechanicsscasc mechanics[1] = AddStaticVehicle(525,2078.4646,-2003.8898,13.4060,269.1910,17,20); // mechanicsscasc mechanics[2] = AddStaticVehicle(525,2068.5046,-1997.1852,13.4221,272.1003,17,20); // mechanicsscasc mechanics[3] = AddStaticVehicle(525,2065.5330,-1990.7363,13.4534,272.0720,17,20); // mechanicsscasc psdc[0] = AddStaticVehicle(420,1777.8099,-1912.6986,13.1657,270.7092,6,1); // taxi psdc[1] = AddStaticVehicle(420,1777.9800,-1906.8815,13.1658,268.8771,6,1); // taxi psdc[2] = AddStaticVehicle(420,1777.8800,-1900.2737,13.1677,268.6656,6,1); // taxi psdc[3] = AddStaticVehicle(420,1778.2097,-1893.7990,13.1695,269.3786,6,1); // taxi psdc[4] = AddStaticVehicle(420,1778.4995,-1886.5010,13.1657,270.3654,6,1); // taxi psdc[5] = AddStaticVehicle(431,1777.7548,-1928.8018,13.4913,358.5206,75,59); // buss psdc[6] = AddStaticVehicle(431,1784.7960,-1929.0233,13.4854,1.2589,75,59); // buss psdc[7] = AddStaticVehicle(431,1790.4385,-1928.9188,13.4920,359.7748,75,59); // buss psdc[8] = AddStaticVehicle(431,1796.2185,-1929.5474,13.4883,1.0316,75,59); // buss psdc[9] = AddStaticVehicle(431,1803.5100,-1929.3397,13.4843,0.9385,75,59); // buss policec[0] = AddStaticVehicle(596,1535.8578,-1677.9369,13.1044,359.6648,0,1); // cops policec[1] = AddStaticVehicle(596,1535.7859,-1667.0427,13.1042,359.7203,0,1); // cops policec[2] = AddStaticVehicle(596,1601.0013,-1684.1238,5.6118,89.3490,0,1); // cops policec[3] = AddStaticVehicle(596,1602.1743,-1691.7617,5.6107,89.1581,0,1); // cops policec[4] = AddStaticVehicle(596,1601.8490,-1700.1804,5.6125,88.6244,0,1); // cops policec[5] = AddStaticVehicle(523,1604.2047,-1708.6970,5.4628,45.4675,0,0); // copss policec[6] = AddStaticVehicle(523,1602.5605,-1710.8755,5.4610,48.0118,0,0); // copss policec[7] = AddStaticVehicle(523,1598.0466,-1713.0381,5.4618,0.7185,0,0); // copss AddStaticVehicle(510,1063.6793,-1775.9258,12.9517,272.8377,46,46); // civilll AddStaticVehicle(510,1063.3281,-1769.9362,12.9726,271.0715,46,46); // civilll AddStaticVehicle(510,1063.5045,-1772.9581,12.9618,272.2037,46,46); // civilll AddStaticVehicle(411,1062.9855,-1763.6332,13.1193,270.7665,64,1); // civilll AddStaticVehicle(411,1098.9248,-1763.9442,13.0763,267.5032,64,1); // civilll AddStaticVehicle(475,1062.9132,-1743.2294,13.2687,269.9456,9,39); // civilll AddStaticVehicle(475,1078.7573,-1763.8707,13.1756,270.3465,9,39); // civilll AddStaticVehicle(560,1083.4089,-1755.0792,13.0921,271.8628,9,39); // civillll AddStaticVehicle(589,1098.1686,-1755.0533,13.0149,88.9525,31,31); // civillll medics[0] = AddStaticVehicle(416,1181.1697,-1309.3839,13.8037,269.9174,1,3); // medddd medics[1] = AddStaticVehicle(416,1181.2279,-1338.8867,13.8827,268.9961,1,3); // medddd medics[2] = AddStaticVehicle(416,1140.9242,-1382.3412,13.9387,179.5405,1,3); // medddd medics[3] = AddStaticVehicle(416,1148.4689,-1380.6226,13.9568,180.2622,1,3); // medddd medics[4] = AddStaticVehicle(416,1137.0083,-1295.7498,13.7101,0.2067,1,3); // medddd medics[5] = AddStaticVehicle(416,1147.0767,-1294.0543,13.8008,4.4205,1,3); // medddd firec[0] = AddStaticVehicle(407,1753.6068,-1455.8077,13.7837,351.6242,3,1); // fiererererer firec[1] = AddStaticVehicle(407,1743.6035,-1455.3623,13.7654,358.6827,3,1); // fiererererer return 1; } public OnGameModeExit() { return 1; } public OnPlayerRequestClass(playerid, classid) { SetPlayerPos(playerid, -1753.5938,884.9380,295.8750); SetPlayerFacingAngle(playerid, 6.2723); SetPlayerCameraPos(playerid, -1753.6976,888.0369,297.1271); SetPlayerCameraLookAt(playerid, -1753.5938,884.9380,295.8750); return 1; } public OnPlayerConnect(playerid) { return 1; } public OnPlayerDisconnect(playerid, reason) { return 1; } forward GateCheck(); public GateCheck() { for(new i; i < MAX_PLAYERS; i++) // Start the loop { if(IsPlayerInRangeOfPoint(i, 15.0, 1961.97131, -2189.60107, 15.47873)) //Check if any player is in the area. Replace '8.0, 3.0, 10.0' with your own coordinates of your closed gate. { if(gateopen == false) // If the gate isn't open... { MoveObject(gate, 1961.97131, -2189.60107, 9.75346, 3.5); //Then open it! Change '32.0, 12.0, 10.0' to the coordinates of your opened gate. gateopen = true; // Setting this to true indicates it's open(ing) } return; //This closes the callback } } //This is called if nobody has been found near the gate. Obviously, because 'return' would fully close the function and this wouldn't be used then. if(gateopen == true) //If the gate IS open, but there's no one near.. { MoveObject(gate, 1961.97131, -2189.60107, 15.47873, 3.5); // Change the '8.0, 3.0, 10.0' to the coordinates of your gate when it's closed. gateopen = false; //This indicates the gate is closed again. Or at least, closing. } } public OnPlayerSpawn(playerid) { SetPlayerToTeamColour(playerid); return 1; } public OnPlayerDeath(playerid, killerid, reason) { return 1; } public OnVehicleSpawn(vehicleid) { return 1; } public OnVehicleDeath(vehicleid, killerid) { return 1; } public OnPlayerText(playerid, text[]) { return 1; } public OnPlayerCommandText(playerid, cmdtext[]) { if (strcmp("/mycommand", cmdtext, true, 10) == 0) { // Do something here return 1; } return 0; } public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger) { return 1; } public OnPlayerExitVehicle(playerid, vehicleid) { return 1; } public OnPlayerStateChange(playerid, newstate, oldstate) { if(newstate == PLAYER_STATE_DRIVER) { if(GetPlayerVehicleID(playerid) == pilotc[0] || GetPlayerVehicleID(playerid) == pilotc[1] || GetPlayerVehicleID(playerid) == pilotc[2]) { if(gTeam[playerid] != PILOT) { SendClientMessage(playerid,CIVILIAN_COLOUR,"Only pilots can use this vehicle."); RemovePlayerFromVehicle(playerid); return 1; } } if(GetPlayerVehicleID(playerid) == hitmanc[0 || 1 || 2 || 3 || 4]) { if(gTeam[playerid] != HITMAN) { SendClientMessage(playerid,CIVILIAN_COLOUR,"Only hitmen can use this vehicle."); RemovePlayerFromVehicle(playerid); return 1; } } if(GetPlayerVehicleID(playerid) == dockc[0 || 1 || 2 || 3 || 4 || 5]) { if(gTeam[playerid] != DOCK) { SendClientMessage(playerid,CIVILIAN_COLOUR,"Only dockworkers can use this vehicle."); RemovePlayerFromVehicle(playerid); return 1; } } if(GetPlayerVehicleID(playerid) == assassinc[0 || 1 || 2]) { if(gTeam[playerid] != ASSASSIN) { SendClientMessage(playerid,CIVILIAN_COLOUR,"Only assassins can use this vehicle."); RemovePlayerFromVehicle(playerid); return 1; } } if(GetPlayerVehicleID(playerid) == mechanics[0 || 1 || 2 || 3]) { if(gTeam[playerid] != MECHANIC) { SendClientMessage(playerid,CIVILIAN_COLOUR,"Only mechanics can use this vehicle."); RemovePlayerFromVehicle(playerid); return 1; } } if(GetPlayerVehicleID(playerid) == psdc[0 || 1 || 2 || 3 || 4 || 5 || 6 || 7 || 8 || 9]) { if(gTeam[playerid] != PSD) { SendClientMessage(playerid,CIVILIAN_COLOUR,"Only public service drivers can use this vehicle."); RemovePlayerFromVehicle(playerid); return 1; } } if(GetPlayerVehicleID(playerid) == policec[0 || 1 || 2 || 3 || 4 || 5 || 6 || 7]) { if(gTeam[playerid] != POLICE) { SendClientMessage(playerid,CIVILIAN_COLOUR,"Only cops can use this vehicle."); RemovePlayerFromVehicle(playerid); return 1; } } if(GetPlayerVehicleID(playerid) == medics[0 || 1 || 2 || 3 || 4 || 5]) { if(gTeam[playerid] != MEDIC) { SendClientMessage(playerid,CIVILIAN_COLOUR,"Only medics can use this vehicle."); RemovePlayerFromVehicle(playerid); return 1; } if(GetPlayerVehicleID(playerid) == firec[0 || 1 || 2 || 3]) { if(gTeam[playerid] != FIRE) { SendClientMessage(playerid,CIVILIAN_COLOUR,"Only firemen can use this vehicle."); RemovePlayerFromVehicle(playerid); return 1; } } } } return 1; } public OnPlayerEnterCheckpoint(playerid) { return 1; } public OnPlayerLeaveCheckpoint(playerid) { return 1; } public OnPlayerEnterRaceCheckpoint(playerid) { return 1; } public OnPlayerLeaveRaceCheckpoint(playerid) { return 1; } public OnRconCommand(cmd[]) { return 1; } public OnPlayerRequestSpawn(playerid) { return 1; } public OnObjectMoved(objectid) { return 1; } public OnPlayerObjectMoved(playerid, objectid) { return 1; } public OnPlayerPickUpPickup(playerid, pickupid) { return 1; } public OnVehicleMod(playerid, vehicleid, componentid) { return 1; } public OnVehiclePaintjob(playerid, vehicleid, paintjobid) { return 1; } public OnVehicleRespray(playerid, vehicleid, color1, color2) { return 1; } public OnPlayerSelectedMenuRow(playerid, row) { return 1; } public OnPlayerExitedMenu(playerid) { return 1; } public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid) { return 1; } public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) { return 1; } public OnRconLoginAttempt(ip[], password[], success) { return 1; } public OnPlayerUpdate(playerid) { return 1; } public OnPlayerStreamIn(playerid, forplayerid) { return 1; } public OnPlayerStreamOut(playerid, forplayerid) { return 1; } public OnVehicleStreamIn(vehicleid, forplayerid) { return 1; } public OnVehicleStreamOut(vehicleid, forplayerid) { return 1; } public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { return 1; } public OnPlayerClickPlayer(playerid, clickedplayerid, source) { return 1; } stock SetPlayerToTeamColour(playerid) { if(gTeam[playerid] == CIVILIAN) SetPlayerColor(playerid, CIVILIAN_COLOUR); if(gTeam[playerid] == POLICE) SetPlayerColor(playerid, POLICE_COLOUR); if(gTeam[playerid] == PSD) SetPlayerColor(playerid, PSD_COLOUR); if(gTeam[playerid] == MECHANIC) SetPlayerColor(playerid, MECHANIC_COLOUR); if(gTeam[playerid] == ASSASSIN) SetPlayerColor(playerid, ASSASSIN_COLOUR); if(gTeam[playerid] == DOCK) SetPlayerColor(playerid, DOCK_COLOUR); if(gTeam[playerid] == HITMAN) SetPlayerColor(playerid, HITMAN_COLOUR); if(gTeam[playerid] == MEDIC) SetPlayerColor(playerid, MEDIC_COLOUR); if(gTeam[playerid] == PILOT) SetPlayerColor(playerid, PILOT_COLOUR); if(gTeam[playerid] == FIRE) SetPlayerColor(playerid, PILOT_COLOUR); } stock SetPlayerTeamFromClass(playerid, classid) { if(classid == 0 || 1) gTeam[playerid] = CIVILIAN; if(classid == 2 || 3) gTeam[playerid] = POLICE; if(classid == 4 || 5) gTeam[playerid] = PSD; if(classid == 6 || 7) gTeam[playerid] = MECHANIC; if(classid == 8 || 9) gTeam[playerid] = ASSASSIN; if(classid == 10 || 11) gTeam[playerid] = DOCK; if(classid == 12 || 13) gTeam[playerid] = HITMAN; if(classid == 14 || 15) gTeam[playerid] = MEDIC; if(classid == 16 || 17) gTeam[playerid] = PILOT; if(classid == 18 || 19) gTeam[playerid] = FIRE; }