15.09.2013, 16:29
If someone enters a vehicle and turn on the engine, whenever that player exit and enters the vehicle again the engine automaticlly stops but you still need to turn off the engine before you can turn it on again!?
How can I fix that??
How can I fix that??
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
new string[128];
new vehicle[24];
GetVehicleName(vehicleid, vehicle, sizeof(vehicle));
for(new i=0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(Spectate[i] == playerid)
{
PlayerSpectateVehicle(i,vehicleid);
}
}
}
if(CarInfo[vehicleid][cLock] == 1)
{
new engine,lights,alarm,bonnet,boot,objective;
SetVehicleParamsEx(vehicleid,engine,lights,alarm,VEHICLE_PARAMS_ON,bonnet,boot,objective);
}
else if(CarInfo[vehicleid][cLock] == 0)
{
new engine,lights,alarm,bonnet,boot,objective;
SetVehicleParamsEx(vehicleid,engine,lights,alarm,VEHICLE_PARAMS_OFF,bonnet,boot,objective);
}
if(IsAnOwnableCar(vehicleid))
{
format(string,sizeof(string),"You are entering to a %s (%d) Private Vehicle, Owner: %s",vehicle, vehicleid, CarInfo[vehicleid][cOwner]);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
}
else if(IsASalesVehicle(vehicleid))
{
format(string,sizeof(string),"You are entering to a %s (%d) Sales Vehicle, Owner: Dealership",vehicle, vehicleid);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
format(string,sizeof(string),"Type /v buy to buy this car for $%d",CarInfo[vehicleid][cPrice]);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
}
else
{
if(IsAGangCar(vehicleid))
{
format(string,sizeof(string),"You are entering to a %s (%d) Faction Vehicle, Owner: Ballas Gang",vehicle, vehicleid);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
}
else if(IsAGangCar2(vehicleid))
{
format(string,sizeof(string),"You are entering to a %s (%d) Faction Vehicle, Owner: Grove Street Family",vehicle, vehicleid);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
}
else if(IsAGangCar3(vehicleid))
{
format(string,sizeof(string),"You are entering to a %s (%d) Faction Vehicle, Owner: Yamaguchi Mafia",vehicle, vehicleid);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
}
else if(IsAGangCar4(vehicleid))
{
format(string,sizeof(string),"You are entering to a %s (%d) Faction Vehicle, Owner: Corleone Mafia",vehicle, vehicleid);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
}
else if(IsAGangCar5(vehicleid))
{
format(string,sizeof(string),"You are entering to a %s (%d) Faction Vehicle, Owner: The Mob",vehicle, vehicleid);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
}
else if(IsAGangCar6(vehicleid))
{
format(string,sizeof(string),"You are entering to a %s (%d) Faction Vehicle, Owner: Sons of Anarchy Gang",vehicle, vehicleid);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
}
else if(IsAGangCar7(vehicleid))
{
format(string,sizeof(string),"You are entering to a %s (%d) Faction Vehicle, Owner: Hitmen Organization",vehicle, vehicleid);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
}
else if(IsACopCar(vehicleid))
{
format(string,sizeof(string),"You are entering to a %s (%d) Faction Vehicle, Owner: Police",vehicle, vehicleid);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
}
else if(IsAGovernmentCar(vehicleid))
{
format(string,sizeof(string),"You are entering to a %s (%d) Faction Vehicle, Owner: Government",vehicle, vehicleid);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
}
else if(IsAnFbiCar(vehicleid))
{
format(string,sizeof(string),"You are entering to a %s (%d) Faction Vehicle, Owner: FBI",vehicle, vehicleid);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
}
else if(IsNgCar(vehicleid))
{
format(string,sizeof(string),"You are entering to a %s (%d) Faction Vehicle, Owner: National Guard",vehicle, vehicleid);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
}
else if(IsASwatCar(vehicleid))
{
format(string,sizeof(string),"You are entering to a %s (%d) Faction Vehicle, Owner: S.W.A.T",vehicle, vehicleid);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
}
else if(IsATacticalCar(vehicleid))
{
format(string,sizeof(string),"You are entering to a %s (%d) Faction Vehicle, Owner: Tactical Team",vehicle, vehicleid);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
}
else if(IsASpecialFCar(vehicleid))
{
format(string,sizeof(string),"You are entering to a %s (%d) Faction Vehicle, Owner: Special Forces",vehicle, vehicleid);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
}
else if(IsAMS13Car(vehicleid))
{
format(string,sizeof(string),"You are entering to a %s (%d) Faction Vehicle, Owner: MS13 Gang",vehicle, vehicleid);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
}
else if(IsAnAmbulance(vehicleid))
{
format(string,sizeof(string),"You are entering to a %s (%d) Faction Vehicle, Owner: LSMD",vehicle, vehicleid);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
}
else
{
format(string,sizeof(string),"You are entering to a %s (%d) Owner: Event Car",vehicle, vehicleid);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
}
}
if(Gps[playerid] == 1)
{
TextDrawShowForPlayer(playerid, Textdraw53[playerid]);
}
if(gTeam[playerid] >= 1||gTeam[playerid] >= 3||gTeam[playerid] >= 4)
{
if (GetVehicleModel(vehicleid) == 520) // Hydra
{
if(IsACop(playerid) && PlayerInfo[playerid][pHydraR] >= 1 && PlayerInfo[playerid][pSpecialF] >= 1 || PlayerInfo[playerid][pAdmin] >= 5 && PlayerInfo[playerid][pAdminDuty] == 1) { }
else { SendClientMessage(playerid, COLOR_LIGHTBLUE, "** Only Special Force Units With Proper Training May use This!!"); new Float:X, Float:Y, Float:Z; GetPlayerPos(playerid, X,Y,Z); SafeSetPlayerPos(playerid, X,Y,Z); }
}
if (GetVehicleModel(vehicleid) == 425) // Hunter
{
if(IsACop(playerid) && PlayerInfo[playerid][pHunterR] >= 1 && PlayerInfo[playerid][pSpecialF] >= 1 || PlayerInfo[playerid][pAdmin] >= 5 && PlayerInfo[playerid][pAdminDuty] == 1) { }
else { SendClientMessage(playerid, COLOR_LIGHTBLUE, "** Only Special Force Units With Proper Training May use This!!"); new Float:X, Float:Y, Float:Z; GetPlayerPos(playerid, X,Y,Z); SafeSetPlayerPos(playerid, X,Y,Z); }
}
if (GetVehicleModel(vehicleid) == 432) // Rhino
{
if(IsACop(playerid) && PlayerInfo[playerid][pRhinoR] >= 1 && PlayerInfo[playerid][pSpecialF] >= 1 || PlayerInfo[playerid][pAdmin] >= 5 && PlayerInfo[playerid][pAdminDuty] == 1) { }
else { SendClientMessage(playerid, COLOR_LIGHTBLUE, "** Only Special Force Units With Proper Training May use This!!"); new Float:X, Float:Y, Float:Z; GetPlayerPos(playerid, X,Y,Z); SafeSetPlayerPos(playerid, X,Y,Z); }
}
if (GetVehicleModel(vehicleid) == 430) // Predator
{
if(IsACop(playerid) && PlayerInfo[playerid][pPredR] >= 1 && PlayerInfo[playerid][pSpecialF] >= 1 || PlayerInfo[playerid][pAdmin] >= 5 && PlayerInfo[playerid][pAdminDuty] == 1) { }
else { SendClientMessage(playerid, COLOR_LIGHTBLUE, "** Only Special Force Units With Proper Training May use This!!"); new Float:X, Float:Y, Float:Z; GetPlayerPos(playerid, X,Y,Z); SafeSetPlayerPos(playerid, X,Y,Z); }
}
}
engineOn[GetPlayerVehicleID(playerid)] = false;
return 1;
}