11.02.2015, 22:36
Hello, I have been trying to figure out how to make the vehicle engine ignite if the person owns the car itself, for example if I have a car and have the keys i can ignite the engine, but if I don't own the car then the vehicle won't ignite. If anyone could help it would be very appreciated.
I just don't know how to start, the problem is that i can't figure out how to detect if the vehicle is his or not.
Here is my detection function to check if the player owns the vehicle.
Player[playerid][PlayerCarModel]
I just don't know how to start, the problem is that i can't figure out how to detect if the vehicle is his or not.
Here is my detection function to check if the player owns the vehicle.
Player[playerid][PlayerCarModel]
Код:
CMD:carengine(playerid, params[])
{
if(strcmp(params,"on",true) == 0)
{
if(Player[playerid][PlayerCarModel] >=1
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
new Vehicle = GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(Vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
SendClientMessage(playerid, COLOR_YELLOW, "You have turned your engine >{FFFFFF} ON");
Engine[Vehicle] = 1, SetVehicleParamsEx(Vehicle, 1, lights, alarm, doors, bonnet, boot, objective);
}
}
if(strcmp(params,"off",true) == 0)
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
new Vehicle = GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(Vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
SendClientMessage(playerid, COLOR_YELLOW, "You have turned your engine >{FFFFFF} OFF");
Engine[Vehicle] = 0, SetVehicleParamsEx(Vehicle, 0, lights, alarm, doors, bonnet, boot, objective);
}
}
return 1;
}

