new LSPD[28];
public OnGameModeInit()
{
//LSPD
LSPD[0] = AddStaticVehicle(596,1528.7373,-1687.9275,5.6120,89.6197,1,0); // Policecar
LSPD[1] = AddStaticVehicle(596,1529.0087,-1683.6345,5.6107,90.3719,1,0); // Policecar
LSPD[2] = AddStaticVehicle(596,1526.7955,-1644.7029,5.6101,359.5225,1,0); // Policecar
LSPD[3] = AddStaticVehicle(596,1530.4741,-1644.5486,5.6083,358.2887,1,0); // Policecar
LSPD[4] = AddStaticVehicle(596,1534.8539,-1645.9208,5.6082,0.0238,1,0); // Policecar
LSPD[5] = AddStaticVehicle(596,1538.7765,-1645.2241,5.6076,0.8801,1,0); // Policecar
LSPD[6] = AddStaticVehicle(596,1545.2113,-1650.8497,5.6123,267.5586,1,0); // Policecar
LSPD[7] = AddStaticVehicle(596,1545.3855,-1655.3594,5.6074,264.3560,1,0); // Policecar
LSPD[8] = AddStaticVehicle(596,1544.4871,-1659.3488,5.6120,271.0551,1,0); // Policecar
LSPD[9] = AddStaticVehicle(596,1545.3839,-1662.9076,5.6103,271.0779,1,0); // Policecar
LSPD[10] = AddStaticVehicle(596,1544.6493,-1667.6846,5.6130,267.3245,1,0); // Policecar
LSPD[11] = AddStaticVehicle(596,1544.3698,-1671.6233,5.6130,266.2461,1,0); // Policecar
LSPD[12] = AddStaticVehicle(596,1544.6852,-1676.1718,5.6071,270.4680,1,0); // Policecar
LSPD[13] = AddStaticVehicle(596,1544.6268,-1679.9368,5.6121,265.9038,1,0); // Policecar
LSPD[14] = AddStaticVehicle(596,1545.4022,-1684.0714,5.6073,269.2596,1,0); // Policecar
LSPD[15] = AddStaticVehicle(427,1559.1028,-1708.9164,6.0223,183.4390,0,1); // Policecar
LSPD[16] = AddStaticVehicle(427,1565.5569,-1709.2582,6.0223,178.4198,0,1); // Policecar
LSPD[17] = AddStaticVehicle(427,1570.6371,-1711.7288,6.0227,180.2581,0,1); // Policecar
LSPD[18] = AddStaticVehicle(427,1575.2072,-1710.1499,6.0225,180.0766,0,1); // Policecar
LSPD[19] = AddStaticVehicle(451,1578.9642,-1710.1852,5.5977,180.5287,0,0); // Policecar
LSPD[20] = AddStaticVehicle(451,1583.8252,-1710.2747,5.5979,180.5677,0,0); // Policecar
LSPD[21] = AddStaticVehicle(451,1587.6625,-1709.0377,5.5985,178.9323,0,0); // Policecar
LSPD[22] = AddStaticVehicle(451,1591.7848,-1710.7012,5.5966,179.2430,0,0); // Policecar
LSPD[23] = AddStaticVehicle(451,1595.3241,-1711.8500,5.5974,182.0077,0,0); // Policecar
LSPD[24] = AddStaticVehicle(522,1584.8099,-1680.4534,5.4704,91.7415,0,1); // Policecar
LSPD[25] = AddStaticVehicle(522,1585.4646,-1676.3069,5.4705,84.0498,0,1); // Policecar
LSPD[26] = AddStaticVehicle(522,1585.2666,-1671.6919,5.4674,92.5899,0,1); // Policecar
LSPD[27] = AddStaticVehicle(522,1584.2675,-1667.6511,5.4655,94.9324,0,1); // Policecar
return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER)
{
new carid = GetPlayerVehicleID(playerid);
if(carid == LSPD[0] && PlayerInfo[playerid][Faction] != 1)
{
RemovePlayerFromVehicle(playerid);
SendErrorMessage(playerid, "You can't enter in the police cars");
}
}
return 1;
}
pawn Код:
|
if(carid == LSPD[0] && PlayerInfo[playerid][Faction] != 1)
new LSPD[28];
//change to
#define LSPD_CARS (28)
new LSPD[LSPD_CARS];
new ptrLSPD = 0;
LSPD[0] = AddStaticVehicle(596,1528.7373,-1687.9275,5.6120,89.6197,1,0);
//Change to
ptrLSPD = AddStaticVehicle(596,1528.7373,-1687.9275,5.6120,89.6197,1,0);
LSPD[0] = ptrLSPD;
//Change
if(carid == LSPD[0] && PlayerInfo[playerid][Faction] != 1)
//to
if(ptrLSPD <= carid <= ptrLSPD + LSPD_CARS && PlayerInfo[playerid][Faction] != 1)
ptrLSPD = AddStaticVehicle(596,1528.7373,-1687.9275,5.6120,89.6197,1,0);
ptrLSPD = AddStaticVehicle(596,1529.0087,-1683.6345,5.6107,90.3719,1,0);
LSPD[0] = ptrLSPD;
LSPD[1] = ptrLSPD;
stock IsLSPDCar(vehicleid)
{
if(GetVehicleModel(vehicleid) == 596 || GetVehicleModel(vehicleid) == 427 || GetVehicleModel(vehicleid) == 451 || GetVehicleModel(vehicleid) == 522) return true;
else return false;
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if(IsPlayerConnected(playerid))
{
if(IsLSPDCar(vehicleid))
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, -1, "You can't enter in police cars.");
}
}
return 1;
}
TogglePlayerControllable(playerid, false);
TogglePlayerControllable(playerid, true);
ptrLSPD = AddStaticVehicle(596,1528.7373,-1687.9275,5.6120,89.6197,1,0);
LSPD[0] = ptrLSPD;
//Nothing changes after this line
LSPD[1] = AddStaticVehicle(596,1529.0087,-1683.6345,5.6107,90.3719,1,0);
LSPD[2] = AddStaticVehicle(596,1526.7955,-1644.7029,5.6101,359.5225,1,0);
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if(IsPlayerConnected(playerid))
{
if(IsLSPDCar(vehicleid))
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, -1, "You can't enter in police cars.");
}
}
return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER)
{
new carid = GetPlayerVehicleID(playerid);
for(new i = 0; i < sizeof(LSPD); i++)
{
if(carid == LSPD[i] && PlayerInfo[playerid][Faction] != 1)
{
RemovePlayerFromVehicle(playerid);
SendErrorMessage(playerid, "You can't enter in the police cars");
}
}
}
return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER)
{
new carid = GetPlayerVehicleID(playerid);
if(PlayerInfo[playerid][Faction] == 1) {
for(new i = 0; i < sizeof(LSPD); i++)
{
if(carid == LSPD[i])
{
RemovePlayerFromVehicle(playerid);
SendErrorMessage(playerid, "You can't enter in the police cars");
break;
}
}
}
}
return 1;
}