04.01.2014, 09:16
Why if i entering car, the engine is automatically on ? i use onplayerkeystatechange and must use "2" button to starting car engine. but why the engine is on if i entering car? and how i can entering car with engine is off ?
This is the code's
This is the code's
Код:
if(newkeys & KEY_SUBMISSION) // New Engine HotKey { 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);} else if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pBVeh]) {SetVehicleParamsEx(vehicleid, 1, lights, alarm, PlayerInfo[playerid][vBLocked], bonnet, boot, objective);} format(string, sizeof(string), "* %s turns the vehicle's engine on.", RPN(playerid)); if(PlayerInfo[playerid][pMaskOn] == 1) { format(string, sizeof(string), "* Stranger turns the vehicle's engine on."); } else { 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);} if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pBVeh]) {SetVehicleParamsEx(vehicleid, 0, lights, alarm, PlayerInfo[playerid][vBLocked], bonnet, boot, objective);} format(string, sizeof(string), "* %s turns the vehicle's engine off.", RPN(playerid)); if(PlayerInfo[playerid][pMaskOn] == 1) { format(string, sizeof(string), "* Stranger turns the vehicle's engine off."); } else { 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; }