03.01.2014, 16:53
i made a thing so when a player tries to enter a locked car alarm too go on and message appear..but i get message when the car is unlocked and alarm goes on when car is unlocked..
PHP код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
new plname[MAX_PLAYER_NAME];
GetPlayerName(playerid, plname, sizeof(plname));
new string[128];
new vehicle[24];
new engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleName(vehicleid, vehicle, sizeof(vehicle));
if(IsAnOwnableCar(vehicleid) && CarInfo[vehicleid][cLock] == 1 && CarInfo[vehicleid][cOwned] == 1)
{
if(IsPlayerAdmin(playerid))
{}
else if(PlayerInfo[playerid][pMember] == 15 && PlayerToPoint(80, playerid, -85.1367,271.1868,8.2266) || PlayerToPoint(80, playerid, -107.7662,279.9160,8.2266) || PlayerToPoint(80, playerid, -75.1942,292.4110,8.2266) || PlayerToPoint(80, playerid, -62.4625,296.0438,8.2266) || PlayerToPoint(80, playerid, -33.0083,339.7525,8.7315) || PlayerToPoint(80, playerid, -22.0927,370.2774,9.0525)) { }
else
{
new Float:cx, Float:cy, Float:cz;
GetPlayerPos(playerid, cx, cy, cz);
SetPlayerPos(playerid, cx, cy, cz);
}
}
if(IsAnOwnableCar(vehicleid))
{
if(CarInfo[vehicleid][cOwned] == 1)
{
format(string,sizeof(string),"Intri in masina %s (%d) Proprietar: %s",vehicle,vehicleid,CarInfo[vehicleid][cOwner]);//this
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
}
}
if(IsAnOwnableCar(vehicleid))
{
if(CarInfo[vehicleid][cOwned] == 1 || CarInfo[vehicleid][cLock] == 1)// cOwner = 1 cLock = 1... so basically if the car is locked then alarm - 0
{
SendClientMessage(playerid, COLOR_RED, "This Vehicle is Closed");//this message and alarm..
GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vehicleid,engine,lights,VEHICLE_PARAMS_ON,doors,bonnet,boot,objective);
SetPVarInt(playerid, "Alarm", 1);
}
}
if(IsAnOwnableCar(vehicleid))
{
if(CarInfo[vehicleid][cOwned] == 0)
{
format(string,sizeof(string),"Intri in masina %s (%d) Proprietar: Dealership",vehicle, vehicleid);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
}
}
else
{
if(IsACopCar(vehicleid))
{
format(string,sizeof(string),"Intri in masina %s (%d) Proprietar: SAPD",vehicle, vehicleid);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
}//this good?
else if(IsAFbiCar(vehicleid))
{
format(string,sizeof(string),"Intri in masina %s (%d) Proprietar: FBI",vehicle, vehicleid);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
}
else if(IsARentCar(vehicleid))
{
format(string,sizeof(string),"Intri in masina %s (%d) Proprietar: Rent",vehicle, vehicleid);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
}
else if(IsATowCar(vehicleid))
{
format(string,sizeof(string),"Intri in masina %s (%d) Proprietar: Tow Company",vehicle, vehicleid);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
}
else if(IsATaxiCar(vehicleid))
{
format(string,sizeof(string),"Intri in masina %s (%d) Proprietar: Taxi Company",vehicle, vehicleid);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
}
else if(IsATigaCar(vehicleid))
{
format(string,sizeof(string),"Intri in masina %s (%d) Proprietar: La Tigani",vehicle, vehicleid);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
}
else if(IsAGlenCar(vehicleid))
{
format(string,sizeof(string),"Intri in masina %s (%d) Proprietar: The Ballas Gang",vehicle, vehicleid);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
}
else if(IsANgCar(vehicleid))
{
format(string,sizeof(string),"Intri in masina %s (%d) Proprietar: National Guard",vehicle, vehicleid);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
}
else if(IsAGovernmentCar(vehicleid))
{
format(string,sizeof(string),"Intri in masina %s (%d) Proprietar: Primaria",vehicle, vehicleid);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
}
else if(IsAFireCar(vehicleid))
{
format(string,sizeof(string),"Intri in masina %s (%d) Proprietar: Los Aztecas Gang",vehicle, vehicleid);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
}
else if(IsAAmbulanceCar(vehicleid))
{
format(string,sizeof(string),"Intri in masina %s (%d) Proprietar: S.M.U.R.D",vehicle, vehicleid);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
}
else if(IsANrCar(vehicleid))
{
format(string,sizeof(string),"Intri in masina %s (%d) Proprietar: News Reporter",vehicle, vehicleid);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
}
else if(IsAYepCar(vehicleid))
{
format(string,sizeof(string),"Intri in masina %s (%d) Proprietar: The Yakuza",vehicle, vehicleid);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
}
else if(IsANapCar(vehicleid))
{
format(string,sizeof(string),"Intri in masina %s (%d) Proprietar: La Cosa Nostra",vehicle, vehicleid);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
}
else if(IsAMafiaCar(vehicleid))
{
format(string,sizeof(string),"Intri in masina %s (%d) Proprietar: The Triads",vehicle, vehicleid);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
}
else if(IsACimentCar(vehicleid))
{
format(string,sizeof(string),"Intri in masina %s (%d) Proprietar: Transport Pietre",vehicle, vehicleid);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
}
else if(IsAFunerarCar(vehicleid))
{
format(string,sizeof(string),"Intri in masina %s (%d) Proprietar: Pompe Funebre",vehicle, vehicleid);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
}
else if(IsABereCar(vehicleid))
{
format(string,sizeof(string),"Intri in masina %s (%d) Proprietar: Distribuitor",vehicle, vehicleid);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
}
else if(IsACurierCar(vehicleid))
{
format(string,sizeof(string),"Intri in masina %s (%d) Proprietar: Curier Rapid",vehicle, vehicleid);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
}
else if(IsAGustaCar(vehicleid))
{
format(string,sizeof(string),"Intri in masina %s (%d) Proprietar: Los Vagos Gang",vehicle, vehicleid);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
}
else if(IsATruck(vehicleid))
{
format(string,sizeof(string),"Intri in masina %s (%d) Proprietar: Trucker",vehicle, vehicleid);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
}
else if(IsAMSCar(vehicleid))
{
format(string,sizeof(string),"Intri in masina %s (%d) Proprietar: Grove Street Gang",vehicle, vehicleid);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
}
}
}