03.08.2014, 23:14
Try this one maybe its better :P
Quote:
command(lights, playerid, params[]) { if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return 1; new engine,lights,alarm,doors,bonnet,boot,objective; new vid = GetPlayerVehicleID(playerid); new string[128]; GetVehicleParamsEx(vid,engine,lights,alarm,doors,b onnet,boot,objective); if(vid != INVALID_VEHICLE_ID) { if(lights == VEHICLE_PARAMS_ON) { SetVehicleParamsEx(vid,engine,VEHICLE_PARAMS_OFF,a larm,doors,bonnet,boot,objective); format(string, sizeof(string), "* %s turns off the vehicle lights.", RPName(playerid)); NearByMessage(playerid, NICESKY, string); } else { if(Vehicles[vid][Battery] >= 1) { SetVehicleParamsEx(vid,engine,VEHICLE_PARAMS_ON,al arm,doors,bonnet,boot,objective); format(string, sizeof(string), "* %s turns on the vehicle lights.", RPName(playerid)); NearByMessage(playerid, NICESKY, string); } else { RemoveTextMessage(playerid); TextDrawShowForPlayer(playerid, Text:OutOfBattery); SetTimerEx("RemoveTextMessage", 3500, false, "d", playerid); } } } return 1; } |