24.12.2014, 11:12
So, at now everyone can start engine but i want that the only owner can start vehicle.
here's the code.
here's the code.
Код:
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 sisestas vхtme ning keeras sььdet.", RPN(playerid)); if(PlayerInfo[playerid][pMaskOn] == 1) { format(string, sizeof(string), "* kдivitas mootori."); } else { format(string, sizeof(string), "* %s sisestas vхtme ja keeras sььdet", 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 keeras sььte vдlja.", RPN(playerid)); if(PlayerInfo[playerid][pMaskOn] == 1) { format(string, sizeof(string), "* keeras sььte vдlja."); } else { format(string, sizeof(string), "* %s keeras sььte vдlja.", RPN(playerid)); } SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE); } return 1; }