if (strcmp("/lights", cmdtext, true, 10) == 0) { new vehicleid, engine, lights, alarm, doors, bonnet, boot, objective; if(!IsPlayerInAnyVehicle(playerid)) { SendClientMessage(playerid, COLOR_RED, "You aren't in a vehicle"); return 1; } if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER) { vehicleid = GetPlayerVehicleID(playerid); if(VehicleLights[vehicleid] == 0) { VehicleLights[vehicleid] = 1; SendClientMessage(playerid, COLOR_YELLOW, "Lights Turned On"); GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective); SetVehicleParamsEx(vehicleid, engine, true, alarm, doors, bonnet, boot, objective); } else if(VehicleLights[vehicleid] == 1) { VehicleLights[vehicleid] = 0; SendClientMessage(playerid, COLOR_YELLOW, "Lights Turned Off"); GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective); SetVehicleParamsEx(vehicleid, engine, false, alarm, doors, bonnet, boot, objective); } } return 1; } return 0; } |
new VehicleLights[MAX_VEHICLES]; |
if (strcmp("/lights", cmdtext, true, 10) == 0) { new veh, engine, lights, alarm, doors, bonnet, boot, objective; if(!IsPlayerInAnyVehicle(playerid)) {SendClientMessage(playerid, 0xFF142BFF, "You aren't in a vehicle");return 1;} if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER) { veh = GetPlayerVehicleID(playerid); if(VehicleLights[veh] == 0) { VehicleLights[veh] = 1; SendClientMessage(playerid, 0xFF9600FF, "Lights Turned On"); GetVehicleParamsEx(veh, engine, lights, alarm, doors, bonnet, boot, objective); SetVehicleParamsEx(veh, engine, 1, alarm, doors, bonnet, boot, objective); } else if(VehicleLights[veh] == 1) { VehicleLights[veh] = 0; SendClientMessage(playerid, 0xFF9600FF, "Lights Turned Off"); GetVehicleParamsEx(veh, engine, lights, alarm, doors, bonnet, boot, objective); SetVehicleParamsEx(veh, engine, 0, alarm, doors, bonnet, boot, objective); } } return 1; }