30.06.2015, 21:06
Hello, My question is how to disable /engine for bicycles?!
I've added this under OnPlayerEnterVehicle
Alright, good for now, so it automatically starts the engine when I get on a bicycle, no need to type /engine.
So , that's my /engine command:
Added this line:
To prevent players turning off the "engine" of the bicycles, but it does nothing, any solutions ?
I've added this under OnPlayerEnterVehicle
Код:
if(GetVehicleModel(vehicleid) == 481 || GetVehicleModel(vehicleid) == 509 || GetVehicleModel(vehicleid) == 510) { new engine, lights, alarm, doors, bonnet, boot, objective; GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective); SetVehicleParamsEx(vehicleid, 1, lights, alarm, doors, bonnet, boot, objective);
So , that's my /engine command:
Код:
CMD:engine(playerid, params[]) { new engine, lights, alarm, doors, bonnet, boot, objective, vehicleid, string[128]; if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command."); if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, COLOR_GREY, "You are not driving a vehicle."); if(vehicleid == 509 || vehicleid == 481 || vehicleid == 510) return SendClientMessage(playerid, COLOR_GREY, "Bicycles have no engine."); vehicleid = GetPlayerVehicleID(playerid); GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective); if(!engine) { SetVehicleParamsEx(vehicleid, 1, lights, alarm, doors, bonnet, boot, objective); if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pVeh]) {SetVehicleParamsEx(vehicleid, 1, lights, alarm, PlayerInfo[playerid][vLocked], bonnet, boot, objective);} else if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pVVeh]) {SetVehicleParamsEx(vehicleid, 1, lights, alarm, PlayerInfo[playerid][vVLocked], bonnet, boot, objective);} format(string, sizeof(string), "* %s turns the vehicle's engine on.", RPN(playerid)); SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE); } else { SetVehicleParamsEx(vehicleid, 0, lights, alarm, doors, bonnet, boot, objective); if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pVeh]) {SetVehicleParamsEx(vehicleid, 0, lights, alarm, PlayerInfo[playerid][vLocked], bonnet, boot, objective);} if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pVVeh]) {SetVehicleParamsEx(vehicleid, 0, lights, alarm, PlayerInfo[playerid][vVLocked], bonnet, boot, objective);} format(string, sizeof(string), "* %s turns the vehicle's engine off.", RPN(playerid)); SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE); } return 1; }
Код:
if(vehicleid == 509 || vehicleid == 481 || vehicleid == 510) return SendClientMessage(playerid, COLOR_GREY, "Bicycles have no engine.");